Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Reset to original program
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Reset to original program

by D0u6 on Sat Jun 06, 2020 4:02 pm

How do I reset the Clue to show the original program that it shipped with? Is the code available?

D0u6
 
Posts: 2
Joined: Sat Jun 06, 2020 3:59 pm

Re: Reset to original program

by dastels on Sat Jun 06, 2020 8:28 pm


dastels
 
Posts: 3410
Joined: Tue Oct 20, 2015 3:22 pm

Re: Reset to original program

by ATSa on Wed Jun 10, 2020 2:07 pm

Greatly appreciate the question, response, and the code share

... am working on draft/adapting code for broadcasting CLUE data via BLE

//global constants and variables

Code: Select all | TOGGLE FULL SIZE
// BlueTooth (BLE) broadcasting/commo
//String BROADCAST_NAME = "Berry32u4";
//String BROADCAST_NAME = "BerryESP32";
String BROADCAST_NAME = "BerryClue";
String BROADCAST_CMD = String("AT+GAPDEVNAME=" + BROADCAST_NAME);
#define BLUEFRUIT_SPI_CS 8
#define BLUEFRUIT_SPI_IRQ 7
#define BLUEFRUIT_SPI_RST 4
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);
uint8_t readPacket(Adafruit_BLE *ble, uint16_t timeout);
float parsefloat(uint8_t *buffer);
void printHex(const uint8_t * data, const uint32_t numBytes);
extern uint8_t packetbuffer[];
char buf[60];


void setup()

Code: Select all | TOGGLE FULL SIZE
  ble.begin();                                        //  Set up bluetooth
  ble.echo(false);                                    //  Turn off echo
  ble.verbose(false);
  BROADCAST_CMD.toCharArray(buf, 60);
  ble.sendCommandCheckOK(buf);
  delay(500);
  ble.setMode(BLUEFRUIT_MODE_DATA);                   //  Set to data mode
  delay(500);


void loop() {
BlueTooth();
}

Code: Select all | TOGGLE FULL SIZE
void BlueTooth()
{
    ble.print(Soil);
    ble.print(",");
    ble.print(tempF);
    //ble.print(',');       
    //ble.print(hum);                           
    //ble.print(',');
    //ble.print(full);
    //ble.print(',');   
    ble.println();
}

ATSa
 
Posts: 13
Joined: Sun Mar 03, 2019 3:00 pm

Re: Reset to original program

by dastels on Wed Jun 10, 2020 4:10 pm

Off to a good start, but plenty more to do.

Dave

dastels
 
Posts: 3410
Joined: Tue Oct 20, 2015 3:22 pm

Re: Reset to original program

by D0u6 on Wed Jun 10, 2020 9:26 pm


D0u6
 
Posts: 2
Joined: Sat Jun 06, 2020 3:59 pm

Re: Reset to original program

by defragster on Fri Jun 26, 2020 3:30 pm

Thanks for that Dave - glad I found this post as I had the same question for new boards here.

It was also good that in getting it to run led me to get the other few ( dozen?) libraries needed for full support - after deciphering the failed build output.

Then I saw that the loop() takes over 540ms to update - and didn't find it being held up by delay()'s

defragster
 
Posts: 13
Joined: Sun Apr 05, 2015 5:48 am

Re: Reset to original program

by dastels on Fri Jun 26, 2020 3:35 pm

I haven't looked closely, but it's making a bunch of sensor readings sequentially, and they can take time.

Dave

dastels
 
Posts: 3410
Joined: Tue Oct 20, 2015 3:22 pm

Re: Reset to original program

by defragster on Sat Jun 27, 2020 4:32 am

Did a quick sketch comparing loop() counts doing minimal code and a Teensy 3.2 is 5 times faster at 48 MHz than 64 Mhz NRF52.

There is a lot of overhead outside of loop() - perhaps it is RTOS also other build options? The T_3.2 uses a 'similar' Cortex M4 without the floating point support. I hoped for much better from the NRF52 Sense unit - same should apply to the CLUE. I just got both because of the low power and added bluetooth radio. I'm going to take out the display prints from CLUE code such that it would run on the Sense and do Serial.prints to compare to the 540ms the loop takes now. But that won't help the empty loop time

// Loop Counts
// T_3.2 @48 Mhz == 414455
// Sense @64 MHz == 77142

Removing code outside loop staying in a while(1) inside gives these numbers
// Loop Counts : in loop while(1) not leaving loop()
// T_3.2 @48 Mhz == 1874355
// Sense @64 MHz == 1393841

defragster
 
Posts: 13
Joined: Sun Apr 05, 2015 5:48 am

Re: Reset to original program

by summerij on Tue Sep 15, 2020 9:49 pm

OK. So I too needed to reload the original program, which somehow got wiped. I copy and pasted the arcada_clue_test code from the provided link. Now I'm getting the error "File code.py, line 14 SyntaxError: invalid syntax." Any idea what I did wrong? Thanks for any help.

summerij
 
Posts: 7
Joined: Mon Jul 13, 2020 1:38 pm

Re: Reset to original program

by kevinjwalters on Wed Sep 16, 2020 8:49 am

File code.py, line 14 SyntaxError: invalid syntax. sounds like a CircuitPython error. You may have copied the Arduino sketch arcada_clue_sensorplotter.ino to code.py? That's a C++ program which needs compiling and then replaces the CircuitPython interpreter.

There is a repository somewhere which includes compiled versions of the demo code that comes with each board. These are .uf2 files which can you just drop onto the xxxxBOOT drive (a double-click on reset button from CircuitPython). That's much quicker and easier than compiling them. I'll go rummage for it...

The UF2 for the CLUE can be downloaded with the green button link at top of Introducing Adafruit CLUE: Arduino Test.

kevinjwalters
 
Posts: 733
Joined: Sun Oct 01, 2017 3:15 pm

Re: Reset to original program

by summerij on Wed Sep 16, 2020 10:20 am

Kevin. Thank you so much for helping me with this. I will give it a try this evening. I'm completely new to Adafruit and to programing hardware so there is a lot to learn. AND a lot of frustrations. Thank you.

summerij
 
Posts: 7
Joined: Mon Jul 13, 2020 1:38 pm

Re: Reset to original program

by summerij on Thu Sep 17, 2020 7:49 pm

Another question. I got the CLUE_TEST.UF2 onto boot and I'm back to the original setup. Happy about that. So, what do I need to do to edit this .UF2 file to comment out everything but the access/gyro/mag readings? I can't seem to get to CIRCUITPY. The boot drive keeps popping up. In fact, even after ejecting it, it disappears and then pops back onto my desktop (running from a MacBook). Appreciate the help.

summerij
 
Posts: 7
Joined: Mon Jul 13, 2020 1:38 pm

Re: Reset to original program

by kevinjwalters on Thu Sep 17, 2020 8:06 pm

You're now in the C/C++ world of Arduino style programming. The uf2 is effectively the compiled, executable, binary output of a compiler. You need to install the Arduino IDE and then load the "sketch" file downloaded from https://github.com/adafruit/Adafruit_Ar ... _clue_test, edit that, compile it and upload it from the Arduino IDE. Installing the Arduino IDE with the many Arduino libraries needed for the CLUE is described on Introducing Adafruit CLUE: Arduino Support Setup.

kevinjwalters
 
Posts: 733
Joined: Sun Oct 01, 2017 3:15 pm

Re: Reset to original program

by summerij on Fri Sep 18, 2020 2:07 pm

Thank you for your help. So, when would I use the recommended MU editor or Arduino? How does MU work if it doesn't compile my program? Cpp vs. Python?

summerij
 
Posts: 7
Joined: Mon Jul 13, 2020 1:38 pm

Re: Reset to original program

by dastels on Fri Sep 18, 2020 3:04 pm

C++ (aka Arduino) and CircuitPython are completely different language and environments C++ must be compiled and linked before being loaded onto your board. The Arduino app is one way to manage that as well as edit code. CircuitPython source code is loaded and compiled on the board (though can be precompiled ... that's what mpy files are). Mu lets you edit code and communicate with your board.

Dave

dastels
 
Posts: 3410
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.