Permalink
Browse files

Cleaned up project folder, updated Arduino sketch for new UDP API.

  • Loading branch information...
1 parent 9e5e6c0 commit 78ee50c86390f447d4f0220fd9ca6049ed3b1804 @ericbarch committed Sep 30, 2012
Showing with 10 additions and 3 deletions.
  1. +10 −3 ArduinoRobotControl/{ArduinoRobotControl.pde → ArduinoRobotControl.ino}
  2. 0 { → old_stuff}/ArduinoDriverStation/ArduinoDriverStation.pde
  3. BIN { → old_stuff}/ArduinoDriverStation/PS2X_lib.zip
  4. 0 {Old → old_stuff}/Java/RobotControlClient/build.xml
  5. BIN {Old → old_stuff}/Java/RobotControlClient/jinput-dx8.dll
  6. BIN {Old → old_stuff}/Java/RobotControlClient/jinput-dx8_64.dll
  7. BIN {Old → old_stuff}/Java/RobotControlClient/jinput-raw.dll
  8. BIN {Old → old_stuff}/Java/RobotControlClient/jinput-raw_64.dll
  9. BIN {Old → old_stuff}/Java/RobotControlClient/jinput-wintab.dll
  10. BIN {Old → old_stuff}/Java/RobotControlClient/jinput.jar
  11. BIN {Old → old_stuff}/Java/RobotControlClient/jutils.jar
  12. BIN {Old → old_stuff}/Java/RobotControlClient/libjinput-linux.so
  13. BIN {Old → old_stuff}/Java/RobotControlClient/libjinput-linux64.so
  14. BIN {Old → old_stuff}/Java/RobotControlClient/libjinput-osx.jnilib
  15. 0 {Old → old_stuff}/Java/RobotControlClient/manifest.mf
  16. 0 {Old → old_stuff}/Java/RobotControlClient/nbproject/build-impl.xml
  17. 0 {Old → old_stuff}/Java/RobotControlClient/nbproject/genfiles.properties
  18. 0 {Old → old_stuff}/Java/RobotControlClient/nbproject/private/config.properties
  19. 0 {Old → old_stuff}/Java/RobotControlClient/nbproject/private/private.properties
  20. 0 {Old → old_stuff}/Java/RobotControlClient/nbproject/private/private.xml
  21. 0 {Old → old_stuff}/Java/RobotControlClient/nbproject/project.properties
  22. 0 {Old → old_stuff}/Java/RobotControlClient/nbproject/project.xml
  23. 0 {Old → old_stuff}/Java/RobotControlClient/src/robotcontrol/Main.java
  24. 0 {Old → old_stuff}/Java/RobotControlServer/robotcontrolv02.pde
  25. BIN { → old_stuff}/NetduinoRobotControl/NetduinoRobot.zip
  26. 0 {Old → old_stuff}/Perl/perl-arduino.txt
  27. 0 {Old → old_stuff}/Perl/sc.pl
  28. 0 {Old → old_stuff}/Python/oldRev/robotcontrolv02.pde
  29. 0 {Old → old_stuff}/Python/robot_control.py
  30. BIN { → old_stuff}/RobotControlSystem.pdf
@@ -4,7 +4,7 @@
************************************/
#include <SPI.h>
#include <Ethernet.h>
-#include <Udp.h>
+#include <EthernetUdp.h>
#include <Servo.h>
//Set the MAC address, static IP, gateway, and subnet of the network
@@ -13,13 +13,18 @@ byte ip[] = { 192, 168, 1, 22 };
//UDP Stuff
const int PORT = 4444; //Port of incoming UDP data
+
const int PACKET_SIZE = 8; //Size of the joystick data packet
byte joystick_data[PACKET_SIZE]; //Byte array for incoming data - [0] = leftY, [1] = leftX, [2] = rightY, [3] = rightX
//Robot specific stuff
boolean lastState = false; //Keeps track of when we go between enabled/disabled or vice versa
unsigned long lastUpdate = 0; //Keeps track of the last time (ms) we received data
+// An EthernetUDP instance to let us send and receive packets over UDP
+EthernetUDP Udp;
+
+
//Define robot outputs
int pwm01 = 5; //Digital Pin 5
int pwm02 = 6; //Digital Pin 6
@@ -53,8 +58,10 @@ void loop() {
/* This function's sole purpose is to receive data and shove it into the joystick_data byte array */
void xferdata()
{
- if (Udp.available()) {
- Udp.readPacket(joystick_data,PACKET_SIZE);
+ int packetSize = Udp.parsePacket();
+ if(packetSize)
+ {
+ Udp.read(joystick_data, PACKET_SIZE);
lastUpdate = millis();
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 78ee50c

Please sign in to comment.