FireFly 2012 v3: restructured into Data/Converter/IK/Servos classes, IR remote, ultrasonic radar head
From 'hexapodV3 28-april-2012-Backup.rar'. Oud/ is the 2011 code it was based on.
This commit is contained in:
1 parent
2e063fc0d9
commit
f690f307c1
30 files changed
+1990
No files matched your search
@@ -0,0 +1,55 @@
|
||||
//Ultrasone.cpp
|
||||
|
||||
#include "Ultrasone.h"
|
||||
|
||||
void Ultrasone::GetRadar(Data *DataLine)
|
||||
{
|
||||
DataLine->HeadTime = 0;
|
||||
|
||||
#ifdef DEBUGUS
|
||||
Serial.print("### Ultrasone Direction/Position: ");
|
||||
Serial.print(CurrentDirection);
|
||||
Serial.print(", ");
|
||||
Serial.println(CurrentPosition);
|
||||
#endif
|
||||
|
||||
if (CurrentDirection == 0) // Left
|
||||
{
|
||||
if (CurrentPosition > MaxLeft)
|
||||
{
|
||||
CurrentPosition--;
|
||||
DataLine->HeadAngle = CurrentPosition;
|
||||
|
||||
Con.ConvertHead(DataLine);
|
||||
SSC32.MoveHead(DataLine);
|
||||
|
||||
Serial.print("### Ultrasone Distance: ");
|
||||
Serial.println(DataLine->FireFly.GetUltraSoneDistance());
|
||||
}
|
||||
else
|
||||
CurrentDirection = 1;
|
||||
}
|
||||
else if(CurrentDirection == 1) // Right
|
||||
{
|
||||
if (CurrentPosition < MaxRight)
|
||||
{
|
||||
CurrentPosition++;
|
||||
DataLine->HeadAngle = CurrentPosition;
|
||||
|
||||
Con.ConvertHead(DataLine);
|
||||
SSC32.MoveHead(DataLine);
|
||||
|
||||
Serial.print("### Ultrasone Distance: ");
|
||||
Serial.println(DataLine->FireFly.GetUltraSoneDistance());
|
||||
}
|
||||
else
|
||||
CurrentDirection = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user