CRAC Team
/
Nboard_test
CAN
Diff: CAN_test/CAN_communication.cpp
- Revision:
- 0:f155bcb0926e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CAN_test/CAN_communication.cpp Thu Jan 26 09:01:45 2017 +0000 @@ -0,0 +1,48 @@ +#include "mbed.h" +#include "C12832.h" +#include "IHM.h" + + +CAN can1(PA_11,PA_12); +IHM ihm; + + +C12832 lcd(D11, D13, D12, D7, D10); + +DigitalOut red_led(D5); +DigitalOut blue_led(D8); +DigitalOut green_led(D9); + +DigitalIn up(A2); +DigitalIn down(A3); +DigitalIn left(A4); +AnalogIn right(A5); +DigitalIn fire(D4); + +AnalogIn pot1 (A0); +AnalogIn pot2 (A1); + +char counter =0; + + +int main(){ + ihm.LCD_clear(); + lcd.cls(); + while (1) { + if (fire){ + + lcd.printf("Message sent: %d\n",counter); + + blue_led =~blue_led; + wait(0.2); + ihm.LCD_gotoxy(0,0); + ihm.LCD_printf("Message recepet %d",counter); + wait(0.2); + + ihm.BAR_set(counter); + while(fire); + + counter++; + } + } +} \ No newline at end of file