Code for using an Arduino to interface with the RoboRIO over and Ethernet shield and receive commands for color changing LEDs
- RoboRIO
- Arduino with Ethernet. This can be an Arduino with an Ethernet shield, or something like the Yun which has it built in
- Neopixel strip (WS2812 Integrated Light Source)
- Ethernet switch for extra Ethernet ports, so you can use Ethernet on RoboRio both for all your necessities and the fancy lights too
Neopixels connected to Arduino pin 6. Using GRB format at 800KHZ bitstream
- Pin 6 on Arduino/Ethernet shield to white wire (DATAIN) on Neopixel strip
- 5v pin on Arduino/Ethernet shield to red wire (VIN) on Neopixel strip
- GND pin on Arduino/Ethernet shield to black wire (GND) on Neopixel strip
- Arduino Ethernet shield to robot radio (as long as it's somehow connected to Ethernet on the robot side)
- Arduino to USB power
In the Arduino code, to set up IP addresses:
IPAddress ip(10,te,am,3); //Defines a static IP for the Arduino/Ethernet Shield.
// For example: 10,6,70 for ours
IPAddress robotIp(10,te,am,2); //Defines the robot's IP
...
robotClient.connect(robotIp, 5801); //Connects the client instance to the robot's socket at 5801;
On the RIO-side, make sure you have this in robotInit:
public void robotInit() {
...
leds.socketSetup(5801);
...
}
To run on RIO, deploy robotside code with gradle ./gradlew deploy
and also upload the Arduino sketch to the Arduino.
Please check this document for the team's policy for committing code to GitHub!
https://docs.google.com/document/d/1vO_dtVTDw3-l0x0BabiAE5C45O6bJlQeLL1Uy9McOcQ/edit?usp=sharing
Note that you cannot commit directly to master or dev!
This project shall follow the following workflow:
The master branch is considered the stable branch of this project. It may only be updated via pull request from student developer, and then only with Code Leads' approval.
The dev branch is the main working branch. It may only be updated by pull request from uncontrolled branches.
For regular development each developer shall create a "feature branch" this is a branch named in the convention: "feature/name" or "bugfix/name". These are for new features and for bugfixes, respectively.
When work starts on a new feature, its branch will be made off of the latest version of dev, and all development will occur on the branch. When the feature is considered ready, it will be merged onto the dev branch. When merging, automatic merging, LV Merge tool merging, or simply copying and pasting of code fragments may be necessary.