Code
// https://www.aruneworld.com/
// Tested By : Arun(20170430)
// Example Name : AEW_Button_Message.js
// Firmware : Mongoose OS for ESP32
//*******************************//
// This example demonstrates how to react on a button press
// by printing a message on a console.
//
// To try this example,
// 1. Download <code>{{EJS0}}</code> tool from https://mongoose-os.com/software.html
// 2. Run <code>{{EJS1}}</code> tool and install Mongoose OS
// 3. In the UI, navigate to the <code>{{EJS2}}</code> tab and load this example
// Load Mongoose OS API
load('api_gpio.js');
let pin = 0; // GPIO 0 is typically a 'Flash' button
GPIO.set_button_handler(pin, GPIO.PULL_UP, GPIO.INT_EDGE_NEG, 200, function(x) {
print('Button press, pin: ', x);
}, true);
print('Flash button is configured on GPIO pin ', pin);
print('Press the flash button now!');
// https://www.aruneworld.com/
// Tested By : Arun(20170430)
// Example Name : AEW_Button_Message.js
// Firmware : Mongoose OS for ESP32
//*******************************//
// This example demonstrates how to react on a button press
// by printing a message on a console.
//
// To try this example,
// 1. Download <code>{{EJS0}}</code> tool from https://mongoose-os.com/software.html
// 2. Run <code>{{EJS1}}</code> tool and install Mongoose OS
// 3. In the UI, navigate to the <code>{{EJS2}}</code> tab and load this example
// Load Mongoose OS API
load('api_gpio.js');
let pin = 0; // GPIO 0 is typically a 'Flash' button
GPIO.set_button_handler(pin, GPIO.PULL_UP, GPIO.INT_EDGE_NEG, 200, function(x) {
print('Button press, pin: ', x);
}, true);
print('Flash button is configured on GPIO pin ', pin);
print('Press the flash button now!');
// https://www.aruneworld.com/ // Tested By : Arun(20170430) // Example Name : AEW_Button_Message.js // Firmware : Mongoose OS for ESP32 //*******************************// // This example demonstrates how to react on a button press // by printing a message on a console. // // To try this example, // 1. Download <code>{{EJS0}}</code> tool from https://mongoose-os.com/software.html // 2. Run <code>{{EJS1}}</code> tool and install Mongoose OS // 3. In the UI, navigate to the <code>{{EJS2}}</code> tab and load this example // Load Mongoose OS API load('api_gpio.js'); let pin = 0; // GPIO 0 is typically a 'Flash' button GPIO.set_button_handler(pin, GPIO.PULL_UP, GPIO.INT_EDGE_NEG, 200, function(x) { print('Button press, pin: ', x); }, true); print('Flash button is configured on GPIO pin ', pin); print('Press the flash button now!');
Next :
Previous :