Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 4:ae81aeeed069
- Parent:
- 3:690740ab3394
- Child:
- 5:ad66d64c3d33
diff -r 690740ab3394 -r ae81aeeed069 main.cpp
--- a/main.cpp Sat Nov 03 15:46:49 2018 +0000
+++ b/main.cpp Thu Nov 15 07:28:39 2018 +0000
@@ -20,9 +20,9 @@
PwmOut motor_RB(D10);
PwmOut motor_LA(D3);
PwmOut motor_LB(D6);
-PwmOut led_B(A1);
+PwmOut led_B(A5);
PwmOut led_G(A2);
-PwmOut led_R(A5);
+PwmOut led_R(A1);
PwmOut buzzer(D5);
AnalogIn batteryCheck(A0);
@@ -38,26 +38,28 @@
void goForward();
int main() {
- led_R=1;
- led_G=1;
+ led_R=0.5;
+ led_G=0.4;
led_B=1;
beepStart();
pc.baud(115200);
-
radio.begin();
network.begin(/*channel*/ 90, /*node address*/ addr);
- wait_ms(2000);
+ wait(2.0f);
- // Display the (default) setup of the nRF24L01+ chip
+ // goForward();
+
+ // Display the (default) setup this node
pc.printf("My ADDR : %d\r\n", NODE_ADDR);
- pc.printf("Complete Setting");
- beepAfterset();
+ pc.printf("Complete Setting\r\n");
+ // beepAfterset();
+ led_B.write(0.5);
while(1) {
+ // Network should be updated regularly to keep layer going
network.update();
- while ( network.available() )
- {
+ while (network.available()) {
RF24NetworkHeader header_rx;
payload_t payload_rx;
network.read(header_rx,&payload_rx,sizeof(payload_rx));
@@ -69,10 +71,10 @@
void goForward()
{
- motor_RA = 0.5;
+ motor_RA = 1;
motor_RB = 0;
motor_LA = 0;
- motor_LB = 0.5;
+ motor_LB = 1;
}
void onLED(int r, int g, int b)