Lab 17. Control an LED and a buzzer
Control an LED
As explained in https://github.com/dustcloud/smartmeshsdk/tree/develop/app/JsonServer, to blink the LED, you need to issue:
an HTTP PUT request
to URL: http://127.0.0.1:8080/api/v1/oap/{{mote}}/digital_out/INDICATOR_0
here
{{url}}
must be replaced by the MAC address of the mote formatted as in thesm
command
with body:
{ "value": 1 }
or
{ "value": 0 }
create the following Node-RED flow:
What is the configuration of the "LED on" and "LED off" nodes?
Answer 1:
What is the code you wrote in the function node?
Answer 2:
What is the configuration of the "http request" node:
verify that you can switch the LED of your mote on/off
Control a Buzzer
Connect a buzzer to the board
buzzer pin labeled ‘+' to pin
I_MOSI
on your motebuzzer pin labeled '-' to pin
GND
on your mote
adapt the Node-RED flow above, replacing
digital_out/INDICATOR_0
bydigital_out/D4
make sure you can switch the buzzer on/off