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.
Dependencies: mbed mbed-rtos MotionSensor EthernetInterface
Diff: main.cpp
- Revision:
- 22:b7cca3089dfe
- Parent:
- 20:7138ab2f93f7
--- a/main.cpp Sat Jul 16 19:17:28 2016 +0000 +++ b/main.cpp Mon Sep 21 21:45:08 2020 +0000 @@ -37,7 +37,7 @@ //Control Objetcs -PwmOut servo(PTD3); // Servo connected to pin PTD3 +PwmOut servo(PTD1); // Servo connected to pin PTD3 Motor motor; FXOS8700Q_mag mag(PTE25,PTE24,FXOS8700CQ_SLAVE_ADDR1); FXOS8700Q_acc acc( PTE25, PTE24, FXOS8700CQ_SLAVE_ADDR1); @@ -46,7 +46,10 @@ DigitalOut red_led(LED_RED); DigitalOut green_led(LED_GREEN); DigitalOut blue_led(LED_BLUE); -DigitalOut main_led(PTD2); +DigitalOut red_led_s(PTD0); +DigitalOut green_led_s(PTB2); //PTC4 +DigitalOut blue_led_s(PTC12); +DigitalOut main_led(PTC4); //Protocol Objects Receiver rcv; EthernetInterface eth; @@ -80,6 +83,7 @@ void turn_leds_off(); int main(){ + // Initializing sensors: main_led = 1; acc.enable(); @@ -91,16 +95,23 @@ // Protocol initialization + + + printf("Initializing Ethernet!\r\n"); set_leds_color(RED); eth.init(RECEIVER_IFACE_ADDR, RECEIVER_NETMASK_ADDR, RECEIVER_GATEWAY_ADDR); eth.connect(); printf("Protocol initialized! \r\n"); + gyro.start_measure(GYRO_PERIOD); set_leds_color(BLUE); rcv.set_socket(); - gyro.start_measure(GYRO_PERIOD); + main_led = 0; controller_ticker.attach(&control,Ts); + + + //main loop while(1){ readProtocol(); @@ -350,30 +361,42 @@ switch(color) { case RED: - red_led = RGB_LED_ON; + red_led = RGB_LED_ON; + red_led_s = RGB_LED_ON; break; case GREEN: green_led = RGB_LED_ON; + green_led_s = RGB_LED_ON; break; case BLUE: blue_led = RGB_LED_ON; + blue_led_s = RGB_LED_ON; break; case PURPLE: red_led = RGB_LED_ON; blue_led = RGB_LED_ON; + red_led_s = RGB_LED_ON; + blue_led_s = RGB_LED_ON; break; case YELLOW: red_led = RGB_LED_ON; green_led = RGB_LED_ON; + red_led_s = RGB_LED_ON; + green_led_s = RGB_LED_ON; break; case AQUA: blue_led = RGB_LED_ON; green_led = RGB_LED_ON; + blue_led_s = RGB_LED_ON; + green_led_s = RGB_LED_ON; break; case WHITE: red_led = RGB_LED_ON; green_led = RGB_LED_ON; blue_led = RGB_LED_ON; + red_led_s = RGB_LED_ON; + green_led_s = RGB_LED_ON; + blue_led_s = RGB_LED_ON; break; default: break;