Cat_Bot
/
Cat_Bot_sub
sub
Fork of Cat_Bot_sub by
main.cpp
- Committer:
- number_key
- Date:
- 2017-02-02
- Revision:
- 0:31a72c321609
- Child:
- 1:f4ae12a86f80
File content as of revision 0:31a72c321609:
#include "mbed.h" #include "hcsr04.h" //I2C to_main(dp4,dp5); //I2CSlave to_main(dp4,dp5); Serial to_main(dp4,dp5); //Serial pc(USBTX,USBRX); HCSR04 front(dp24,dp25); HCSR04 back(dp22,dp23); HCSR04 right(dp20,dp21); HCSR04 left(dp18,dp19); //DigitalOut led(dp12); //const int addr=0x0A; int main() { char dist[4]={0}; //to_main.baud(19200); //to_main.address(addr); while(1) { front.start(); back.start(); right.start(); left.start(); dist[0]=front.get_dist_cm(); dist[1]=back.get_dist_cm(); dist[2]=right.get_dist_cm(); dist[3]=left.get_dist_cm(); //led=to_main.write(addr,dist,4); //led=to_main.write(dist, 4); to_main.putc(1); for(int i=0;i<4;i++){ to_main.putc(dist[i]); } //pc.putc('\n'); } }