At this point the module slimLSM9DS1.js needs to be tested.
In order to do the testing the menutestSlimLSM9DS1.js has been written, with another program to test the calibration module to follow. WARNING WARNING WARNING
The menu system redirects the USB port away from the console. Without a method to restore the USB-Console connection or reset a Pico you can brick the Pico if you save the menu program. As written the menu program provides three exits. Control-C, Menu option 9, and the pushbutton on the Pico. When you load the program it tells you to type startPGM(); in the left pane of the WebIDE. This is safe. Only save the program once you are convinced that all the exit methods work. This is especially true if you make modifications to the menu program.
Here is an example after the menu program is loaded, started and menu option 9 is selected.
>In left pane type startPgm();
Use startPgm() first and make sure you can exit back to the console
Once you are sure that a proper exit works then type save();
=undefined
>startPgm();
=undefined
-> LoopbackB
Select option or use control-C to exit
0 Configure Gyro
1 Configure Accelerometer
2 Configure Magnetometer
3 Select Display Units
4 Read and Display Data
5 Show Calibration Structure
9 Exit
<- USB
>9
<- LoopbackB
Exit
-> USB
The code to use the pushbutton to reset the Pico is in nobrick.js
It does not redirect the USB port.
//NoBrick.js
// 15 Dec 2016
//
//How not to brick a PICO when reassigning the console
// away from the USB port to do menu programs
//Setup the button to light the LED and reset the Pico
//Always include this code when a save() and oninit() functions are // used.
setWatch(function(e) {
digitalWrite(LED1, e.state);
USB.setConsole();
reset();
}, BTN, { repeat: true });
E.on('init', function() {
console.log("Hello");
startPgm();
});
function startPgm(){
var count=0;
var nn=setInterval(function () {
console.log(count);
count++;
if(count>1000)clearInterval(nn);
}, 200);
}//end startPgm
console.log("In left pane type startPgm();");
console.log("Use startPgm() first and make sure you can exit back to the console");
console.log("Once you are sure that a proper exit works then type save();");
Here are some more menu screens.
-> LoopbackB
Select option or use control-C to exit
0 Configure Gyro
1 Configure Accelerometer
2 Configure Magnetometer
3 Select Display Units
4 Read and Display Data
5 Show Calibration Structure
9 Exit
<- USB
>0
Configure Gyro
Select option or use control-C to exit
0 Set Gyro Scale
1 Set Gyro Output Data Rate
8 Main Menu
9 Exit
0
Set Gyro Scale
Select option or use control-C to exit
Select Gyro Scale
0 for 245 deg/s
1 for 500 deg/s
2 for 2000 deg/s
8 Main Menu
9 Exit
/////// use control-c to exit
<- LoopbackB
_____ _
| __|___ ___ ___ _ _|_|___ ___
| __|_ -| . | _| | | | | . |
|_____|___| _|_| |___|_|_|_|___|
|_| http://espruino.com
1v88 Copyright 2016 G.Williams
>
Read and display data. Pressing the return key twice stops the collection and returns to the main menu. The average data is from a running average of 20 samples.
Select option or use control-C to exit
0 Configure Gyro
1 Configure Accelerometer
2 Configure Magnetometer
3 Select Display Units
4 Read and Display Data
5 Show Calibration Structure
9 Exit
<- USB
>4
Acceleration, -0.00655438823 , 0.01201211252 , 1.05891861454
Avg Acceleration, -0.00655438823 , 0.01201211252 , 1.05891861454
Gyro, -0.03014841387 , -0.77131702053 , 0.19415578534
Avg Gyro, -0.03014841387 , -0.77131702053 , 0.19415578534
Magnetometer, -0.006588 , 0.197274 , -0.217526
Avg Magnetometer -0.006588 , 0.197274 , -0.217526
Temperature 26.24
Level -0.35463914029 0.64992136537
heading 1.91269183128
avg heading 1.91269183128
>
Select option or use control-C to exit
0 Configure Gyro
1 Configure Accelerometer
2 Configure Magnetometer
3 Select Display Units
4 Read and Display Data
5 Show Calibration Structure
9 Exit
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
At this point the module slimLSM9DS1.js needs to be tested.
In order to do the testing the menutestSlimLSM9DS1.js has been written, with another program to test the calibration module to follow.
WARNING WARNING WARNING
The menu system redirects the USB port away from the console. Without a method to restore the USB-Console connection or reset a Pico you can brick the Pico if you save the menu program. As written the menu program provides three exits. Control-C, Menu option 9, and the pushbutton on the Pico. When you load the program it tells you to type startPGM(); in the left pane of the WebIDE. This is safe. Only save the program once you are convinced that all the exit methods work. This is especially true if you make modifications to the menu program.
Here is an example after the menu program is loaded, started and menu option 9 is selected.
The code to use the pushbutton to reset the Pico is in nobrick.js
It does not redirect the USB port.
Here are some more menu screens.
Read and display data. Pressing the return key twice stops the collection and returns to the main menu. The average data is from a running average of 20 samples.
3 Attachments