Help using Arduino to code my Jewelbot


#1

Hello!

I’m stuck using Arduino, and I’m wondering if I have it set up correctly.

The only Port I see is called ’dev/cu.Bluetooth-Incoming-Port' … is that correct?

After I paste in the sample code (about making one of the LEDs turn blue) and I hit ‘Upload’ it takes about two minutes, then I see the success rainbow and it vibrates.

Here is the message we get:

Failed to execute script __main__
Upgrading target on /dev/cu.Bluetooth-Incoming-Port with DFU package /private/var/folders/rv/_d5bzyxx2xx1bj85d93wh0wm0000gn/T/arduino_build_963677/sketch_nov26e.ino.zip. Flow control is disabled.

Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 19784
Sending DFU start packet, afterwards we wait for the flash on target to be initialized before continuing.
Timed out waiting for acknowledgement from device.

Failed to upgrade target. Error is: No data received on serial port. Not able to proceed.

Possible causes:
- bootloader, SoftDevice or application on target does not match the requirements in the DFU package.
- baud rate or flow control is not the same as in the target bootloader.
- target is not in DFU mode. If using the SDK examples, press Button 4 and RESET and release both to enter DFU mode.
Failed to execute script __main__

After this, I’m not sure what to do in order to see the code run. I unplug it but nothing happens… I’m sure I’ve missed a step somewhere, though…

Thank you SO much, I really love my Jewelbot! :heart_eyes:


#2

We’re so glad you love your Jewelbot!

No, that’s not the right port. Is that the only one you are seeing?

Also, once you are on the correct port make sure you are putting the device into coding mode by hitting the button for two seconds.

The success rainbow you are seeing is it coming out of coding mode, it seems, not the successful upload of code. We’re working to make those different.


#3

Ah! I thought there was something wrong, Port-wise. :slight_smile:

Thanks so much for your reply!

I think I will try this on our PC instead of my Mac, because that is the only port I’m seeing on my Mac.


#5

Sometimes when that happens on my Mac I need a restart for either the machine or the Arduino IDE. YMMV.


#6

I am having this problem as well. The port that I am using on my Mac is “/dev/cu.usbserial-DB010WIP”. I just got mine for Christmas and I cannot wait for to use it. I have updated the firmware, installed the JewelBots Arduino Library, and I tried to run this simple code:

#include “Arduino.h”
void setup() {
// put your setup code here, to run once:
}

void loop() {
// put your main code here, to run repeatedly:
LED led;
led.turn_on_single(NE, GREEN);
}
In orange colored font it told me:

Failed to execute script main
Upgrading target on /dev/cu.usbserial-DB010WIP with DFU package /private/var/folders/sq/1j428x_n0wn0yvjmtzjdql_r0000gn/T/arduino_build_137444/DEMO.ino.zip. Flow control is disabled.

Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 19968
Sending DFU start packet, afterwards we wait for the flash on target to be initialized before continuing.
Sending DFU init packet
Sending firmware file
DFU upgrade took 17.3787841797s
Device programmed.
Failed to execute script main

My JewelBot did not light up its North East light and only has its charging light on. Can you help me with this problem @sara ?


#7

Hi @Alexab33,

Did you unplug your Jewelbots after uploading the code? That should do it, let me know if it doesn’t.


#8

Thank you, @sara ! The light turned on! I am so excited to find out more about my JewelBot!


#9

I was completing this code for fun. I had sheet music from the Orchestra played in and I wanted to play with the LEDs, so I created this code with a hashtag starting the first line:

include “Arduino.h”

void setup() {
// put your setup code here, to run once:

}
void loop () {
}
void button_press(void) {

LED led;
Buzzer buzz;
Timer timer;
int beatsperminute = 120;
int quarternote = 1000/beatsperminute;
int wholenote = 4quarternote;
int halfnote = 2
quarternote;
int eighthnote = quarternote/2;
int sixteenthnote = quarternote/4;

for (int x = 1; x <= 6; x++);
{
led.flash_all(GREEN, quarternote);
led.flash_all(BLUE, eighthnote);
led.flash_all(BLUE, eighthnote);
timer.pause(eighthnote);
led.flash_all(BLUE, eighthnote);
led.flash_all(GREEN, quarternote);
led.flash_all(GREEN, quarternote);
led.flash_all(GREEN, quarternote);
led.flash_all(GREEN, quarternote);
led.flash_all(BLUE, eighthnote);
led.flash_all(BLUE, eighthnote);
timer.pause(eighthnote);
led.flash_all(BLUE, eighthnote);
led.flash_all(GREEN, quarternote);
led.flash_all(BLUE, eighthnote);
led.flash_all(BLUE, eighthnote);
led.flash_all(GREEN, quarternote);
}
}

In orange I got this message:

Failed to execute script main
Upgrading target on /dev/cu.usbserial-DB010WIP with DFU package /private/var/folders/sq/1j428x_n0wn0yvjmtzjdql_r0000gn/T/arduino_build_709337/DEMO.ino.zip. Flow control is disabled.

Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 22732
Sending DFU start packet, afterwards we wait for the flash on target to be initialized before continuing.
Sending DFU init packet
Sending firmware file
DFU upgrade took 18.2518289089s
Device programmed.
Failed to execute script main

When I took my JewelBot out of the USB cord and clicked the button, the program did not play. Is there something I can do to fix this? Also, for this project I decided to use LEDs because you could put the amount of seconds. Buzzer would be more effective though. If we can put an amount of milliseconds on the buzzer I would definitely use it instead of the LEDs in this case. I love this JewelBot! It is so cool!:heart_eyes: Also, I accidentally messaged you sorry.


#10

Hi @Alexab33

It is super cool that you are using musical elements for your Jewelbot!!

I am unsure why nothing is lighting up though when you unpllugged it.
If you notice from the orange text, the second to last line it says “Device Programmed”.
You can ignore the “failed to execute script main”. That appears for Mac users, and we are unsure why yet.

Try putting “uint8_t” instead of int, and see what happens! I am unable to test it for you since I do not have my personal Jewelbot on me at the moment. However, that might work ?


#11

Hey @Quymbee, I think she just needs to call the button_press function. So, just put the following in her setup function and she should be good.

 void setup() {
button_press();
}

#12

I am still struggling to get this to work. Any additional advice? Can you check it for me?


#13

Hi @Alexab33,

This is such a cool thing to make–I love how you are translating sheet music to code!

I tried out your code my Jewelbot. I think it is running just fine but the lights are blinking for so short of a time that you can’t see them! The value for quarternote is 1000/120 which is way less than one second.

I changed the following line:

int quarternote = 1000/beatsperminute;

to

int quarternote = 60000/beatsperminute;

(60000 is the number of miliseconds in one minute, and I think you would divide that by the number of beats per minute to get the value of a quarternote?)

You also do not need the semicolon in the for loop–I changed

for (int x = 1; x <= 6; x++);

to

for (int x = 1; x <= 6; x++)

Here is the full updated code that runs fine on my Jewelbot:

#include "Arduino.h"

void setup() {
// put your setup code here, to run once:

}
void loop () {
}
void button_press(void) {

LED led;
Buzzer buzz;
Timer timer;
int beatsperminute = 120;
int quarternote = 60000/beatsperminute;
int wholenote = 4*quarternote;
int halfnote = 2*quarternote;
int eighthnote = quarternote/2;
int sixteenthnote = quarternote/4;

for (int x = 1; x <= 6; x++)
{
led.flash_all(GREEN, quarternote);
led.flash_all(BLUE, eighthnote);
led.flash_all(BLUE, eighthnote);
timer.pause(eighthnote);
led.flash_all(BLUE, eighthnote);
led.flash_all(GREEN, quarternote);
led.flash_all(GREEN, quarternote);
led.flash_all(GREEN, quarternote);
led.flash_all(GREEN, quarternote);
led.flash_all(BLUE, eighthnote);
led.flash_all(BLUE, eighthnote);
timer.pause(eighthnote);
led.flash_all(BLUE, eighthnote);
led.flash_all(GREEN, quarternote);
led.flash_all(BLUE, eighthnote);
led.flash_all(BLUE, eighthnote);
led.flash_all(GREEN, quarternote);
}
}

Let me know if this works for you!


#14

Thank you so much for helping me! It worked, and I am so happy!:grinning:


#15

Yay, glad to hear it!


#16

New to Arduino… possibly silly question…

Can get the code to work on the Jewelbot, but I get that same message: Failed to execute script main etc…

I thought that was an error message. That’s normal behavior?

Again, code runs fine after I unplug and press magic button.

Thanks.


#17

Hi @kirklove,

I’m getting this message too. I think it’s safe to ignore. FWIW, I’m on macOS.


#18

@kirklove

If you are a Mac user, then its okay to ignore “failed to execute script main”.
We are unsure why the Arduino IDE prints that message out when programming the Jewelbot.
Working on a way to avoid it for the future!


#19

There’s a fix for this now :smile:

After applying it, you’ll be able to attach multiple Jewelbots to a single Arduino IDE session and upload sketches to your heart’s content with no relaunches or reboots after installing the correct FTDI drivers on a Mac as well.

Here’s the detailed fix (with a bit of a story of how it was found):