I have a BBC Micro:Bit. It's plugged into the Adeept board, which has an I2c 1602 LCD display, Adeept joystick, and Adeept button module. I have to supply power to the board's USB port to run the LCD display. I made a website and want to be able to sync data from the Micro:Bit to the website (your selected name and other data I add later). I set the name to something. Then I plug in my USB to the computer and Micro:Bit. But when I backup and restore, the name is the first name on the list.
I backed it up without restoring and the page said that the name is the first name (even though I changed it). Then when I navigate to the names "app" on the Micro:Bit, it also shows the first name.
I don't know if this is a problem with supplying power or the code.
My script is here: https://repl.it/@awesomecrater/smartmicrobit#script.js
I am using this library https://github.com/bsiever/microbit-webusb/blob/master/ubitwebusb.js from GitHub and the code on the Micro:Bit to receive the backup signal looks something like this in pseudocode:
When serial received with New Line {
Split the data at "|||||||" and store it in serialthing
If the first item in serialthing is "backup" {
write the variable name to the serial output
} Else if the first item in serialthing is "name" {
convert the second item in serialthing to a number and store it in name.
}
}
Does anyone know why it is setting it back to the first item in the list?
name
stores the current item of the list as an index.