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
main.cpp
- Committer:
- iainsc0574
- Date:
- 2017-02-16
- Revision:
- 0:6bf5faf294b7
- Child:
- 1:832c213480a8
File content as of revision 0:6bf5faf294b7:
#include "mbed.h"
#define MAX 0x0A
DigitalOut led_1(LED1); //program running.
DigitalOut led_2(LED2); //sensors operating.
DigitalOut led_3(LED3); //is moving.
DigitalOut led_4(LED4); //is complete.
DigitalOut Bit1(p25);
DigitalOut Bit2(p24);
DigitalOut Bit3(p23);
int rawUS_data[5]={0,0,0,0,0}; //raw data{chan1,chan2,chan3,chan4,chan5}
int US1_mean[MAX]={0,0,0,0,0,0,0,0,0,0};
int US2_mean[MAX]={0,0,0,0,0,0,0,0,0,0};
int US3_mean[MAX]={0,0,0,0,0,0,0,0,0,0};
int US4_mean[MAX]={0,0,0,0,0,0,0,0,0,0};
int US5_mean[MAX]={0,0,0,0,0,0,0,0,0,0};
void setActiveUS(int chan);
int getPing(void);
int main() {
int iCount = 0;
int measured = 0;
while(iCount <= 5){
setActiveUS(iCount);
measured = getPing();
rawUS_data[iCount] = measured;
}
US1_mean[0]=rawUS_data[0];
US2_mean[0]=rawUS_data[1];
US3_mean[0]=rawUS_data[2];
US4_mean[0]=rawUS_data[3];
US5_mean[0]=rawUS_data[4];
}
void setActiveUS(int chan){
switch(chan){
case 0:
//ultrasonic 1
break;
case 1:
//ultrasonic 2
break;
case 2:
//ultrasonic 3
break;
case 3:
//ultrasonic 4
break;
case 4:
//ultrasonic 5
break;
}
}
int getPing(void){
int result=0;
//write ultrasonic code
//return measured value
return result;
}