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.
color.h
- Committer:
- namikosaito
- Date:
- 2016-02-29
- Revision:
- 3:04f6fe153dbc
- Parent:
- 0:77188ca200ce
- Child:
- 5:f90bd93f8558
File content as of revision 3:04f6fe153dbc:
#include "mbed.h" int blue,red,yellow,white_r,white_l,white_mr,white_ml,white_m; CAN can1(p30, p29); /*IO通信用*/ DigitalIn blue_pin(p26); DigitalIn white_pin(p27); unsigned char data,data_1; //char void judge_color(void){ CANMessage msg; if(can1.read(msg)&&msg.id==1337) { data=msg.data[0]; data_1=data; if(data/128==1)white_l=1; else white_l=0; data%=128; if(data/64==1)white_ml=1; else white_ml=0; data%=64; if(data/32==1)white_m=1; else white_m=0; data%=32; if(data/16==1)white_mr=1; else white_mr=0; data%=16; if(data/8==1)white_r=1; else white_r=0; data%=8; if(data/4==1)yellow=1; else yellow=0; data%=4; if(data/2==1)blue=1; else blue=0; data%=2; if(data/1==1)red=1; else red=0; } /*IO通信*/ if(blue_pin==1)blue=1; //if(white_pin==1)white_m=1; }