misc changes

This commit is contained in:
5shekel 2016-02-21 14:05:34 +08:00
parent 379bb0f76f
commit 4cd00678b7
2 changed files with 11 additions and 35 deletions

35
.gitignore vendored
View File

@ -1,32 +1,3 @@
# Object files .pioenvs
*.o .clang_complete
*.ko .gcc-flags.json
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/

View File

@ -53,7 +53,7 @@ void setup() {
radio.openReadingPipe(1, addresses[0]); radio.openReadingPipe(1, addresses[0]);
radio.startListening(); radio.startListening();
Serial << "im a bot!" << endl; if(DEBUG) Serial << "im a bot!" << endl;
} else { } else {
role = role_ping_out; role = role_ping_out;
@ -61,7 +61,7 @@ void setup() {
radio.openReadingPipe(1, addresses[1]); radio.openReadingPipe(1, addresses[1]);
radio.stopListening(); radio.stopListening();
Serial << "im a controller!" << endl; if(DEBUG) Serial << "im a controller!" << endl;
} }
if(role==role_pong_back) if(role==role_pong_back)
@ -90,14 +90,19 @@ void loop() {
/****************** Ping Out Role ***************************/ /****************** Ping Out Role ***************************/
if (role == role_ping_out) { if (role == role_ping_out) {
myData.xin = analogRead(AX_pin); myData.xin = analogRead(AX_pin);
if(myData.xin == 517){ myData.xin = 518;} //terrible hack.
myData.yin = analogRead(AY_pin); myData.yin = analogRead(AY_pin);
bool ok = radio.write( &myData, sizeof(myData) ); bool ok = radio.write( &myData, sizeof(myData) );
if(DEBUG) Serial<<"xin:"<<myData.xin<<" yin:"<<myData.yin<<endl;
/*
if (ok) if (ok)
Serial << "transfer OK \n\r"; Serial << "transfer OK \n\r";
else else
Serial << "transfer failed \n\r"; Serial << "transfer failed \n\r";
*/
} }
@ -119,7 +124,7 @@ void loop() {
leftMotorSpeed = constrain(y2pwm + x2pwm, -255, 255); leftMotorSpeed = constrain(y2pwm + x2pwm, -255, 255);
rightMotorSpeed = constrain(y2pwm - x2pwm, -255, 255); rightMotorSpeed = constrain(y2pwm - x2pwm, -255, 255);
if (myData.xin == 518) if (myData.xin == 518 )
stop(0); stop(0);
else else
move(0, leftMotorSpeed); move(0, leftMotorSpeed);