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:
- st17099ng
- Date:
- 2019-03-05
- Revision:
- 0:bba4760cb391
- Child:
- 1:72b8490a4ece
File content as of revision 0:bba4760cb391:
#include "mbed.h"
#include "Help.h"
Serial pc(USBTX,USBRX);
DigitalOut POWER_LED(D5);
int direct,speed;
int Raxis[2],Laxis[2];
char Rfmot,Lfmot;
char Rbmot,Lbmot;
char mot1,air1;
int main(void)
{
speed = fast;
direct = sb;
format_data(&Rfmot);
format_data(&Lfmot);
format_data(&Rbmot);
format_data(&Lbmot);
format_data(&mot1);
format_data(&air1);
POWER_LED = 1;
while(1) {
get_stick(Raxis,'R');
get_stick(Laxis,'L');
speed = set_speed(speed);
direct = set_direct(Raxis, Laxis);
set_emg();
if(direct != 0) {
set_tire(&Rfmot, &Rbmot, direct, 'R', speed);
set_tire(&Lfmot, &Lbmot, direct, 'L', speed);
} else {
set_slide(&Rfmot,&Lfmot,&Rbmot,&Lbmot,r1,l1, speed);
}
write_data(Rfmotadd,Rfmot);
write_data(Lfmotadd,Lfmot);
write_data(Rbmotadd,Rbmot);
write_data(Lbmotadd,Lbmot);
write_data(Lbmotadd,Lbmot);
pri("\033[2J\033[1;1H RX:%d",Raxis[0]);
pri("\033[2;1H RY:%d",Raxis[1]);
pri("\033[3;1H LX:%d",Laxis[0]);
pri("\033[4;1H LY:%d",Laxis[1]);
pri("\033[5;1H Rfmot:0x%x",Rfmot);
pri("\033[6;1H Lfmot:0x%x",Lfmot);
pri("\033[7;1H Rbmot:0x%x",Rbmot);
pri("\033[8;1H Lbmot:0x%x",Lbmot);
pri("\033[9;1H direct:%d",direct);
pri("\033[10;1H speed:%d",speed);
}
}