Legality of Arduino Programming

Okay so our mentor just bought a few of our team mates an ARDUINO UNO to experiment with over the summer, and I have gotten a sparkfun starter kit with 14 cool projects. I finished them all in one day and started experimenting with compatibility on an FRC robot. What I hope to do is create a separate java program with an external slider which works as an LED control, this will constantly send data to the robot’s arduino telling it to change the LEDs to the desired color. I’ve only learnt one way of programming an arduino, which is C, and I’m not very good at it >.< It also is not a language supported by FRC therefor I would like to create a Java program for the arduino which can be complied and controlled by a soft potentiometer. So, is it legal, and if so, what plugins are needed and how to do it >.< please and thankyou :slight_smile: any help or advice is appreciated!

What part of your post are you asking about? Is it legal to use an Arduino? Yes. Teams use Arduinos and other processors all the time.

There isn’t a way to write an arduino program in java, as the arduino is too slow and doesn’t have enough memory to efficiently run a JVM. However, C is simpler than java (it isn’t object oriented), and any program that is written in C will compile in a C++ compiler, which is an FRC supported language.

If you are interested in learning C for arduino, check out the arduino playground for inspiration.

If you do not wish to learn a lot about C, you could write a simple C program for the arduino, that transmits all of the inputs that you are interested in over serial to the cRIO, and receives all your outputs from the cRIO (like the LED light information). Remember, you need to use a level converter for serial communication between the two, as the cRIO uses RS-232, and the arduino uses TTL.

If you are not interested in reading inputs like sensors, and only having the arduino use outputs (like the LED lights), you could use this library from the arduino playground.

Yes, it is legal to use. For the competition, it has to follow the robot rules as a coprocessor. In the off-season/demonstration purposes, you can do whatever you want.

For coding, check out ArduBlock, a graphical Arduino programming environment. I haven’t used it yet, but it appears to get better each week.

This has already been stated, but yes, Arduinos can be used as co-processors on the robot. You mentioned using the Arduino to control LEDs. This was the system we used to control our AdaFruit lights this year. We had a simple C program that was wipped up by one of the members to respond to a few robot inputs and output the robot state in LED form for our drivers(We just used a few Digital outs and ran them to a few Arduino pins).

We briefly discussed using the serial port on the cRIO for this, but we decided a few lost outputs compensated for the removed protocol pain.

If you are familiar with Java, C is not that different. Also, why is the FRC support of a language important to you?

I hope this helps.

We’re setting one up for IRI. It controls a (hand-made) strip of LEDs mounted along our shooter. It does patterns inspired by the lights on 111’s and 118’s bots. As far as I can tell, this is the most common use for the Arduino in FRC- lights.

There are a wide variety of ways to add custom lights to the bot using arduino. We’re just directly connecting each LED to a DIO on the arduino. This is the simplest way(code-wise) to do it, but not the most effective, especially with an UNO or similar. If you want to do this, the best way to go would be to get a Mega2560, MegaADK, or a Due, as they have many more digital/PWM outputs available. However, if you are new to the world of Arduino, other options like multiplexers and I2C can be pretty intimidating.

If you see a team with a lot of lights doing patterns, or multi-colored lights, they likely use I2C. I talked to a mentor from 111 at Midwest about how they did their lights, and he informed me that they use I2C from the arduino to control a strip of RGB LEDs. I do not know how 118 does their lights but I would guess they do it in a similar way.

Best of luck, and if you have any questions about arduino, feel free to PM me!

I am guessing FRC language support is important because he wants to be able to use his knowledge of Arduino Java as a basis for learning FRC Java, or vice versa. But yes, you definitely make a good point when saying Java is very similar to C. Personally, I prefer C because it is used more often in the real world. Our programming team uses labview, though we will be changing over to Java or C within 2 years. The cRio’s serial port didn’t even cross our minds (If you saw how buried the cRio was on our bot you could guess why) but I really like that idea. It would be a neat learning curve for the electrical team and programming team!

Our new-for-IRI arduino lights are just 12 orange LEDs soldered together in a strip :p. I am strongly considering getting some of the adafruit RGBLED strips for our next bot ((Digital RGB LED Weatherproof Strip - LPD8806 32 LED : ID 306 : Adafruit Industries, Unique & fun DIY electronics and kits)). Can you post your code, please? I am very interested in how your system works, as from what I can tell it works completely different from most other bots.

As Evan said, it would be best to get the MEGA 2560 or the Due because of more outputs. I just bought a 2560 because my UNO was too small.

However, if you have an UNO and have shields for it, please note that not all shields for the UNO work on the MEGA.

However, the UNO may work for you. 33 has an uno controlling their LED’s.

The UNO has 5 PWM outputs that serve as part of the 13 digital outputs, wheras the MEGA 2560 has 13 PWM outputs in which 2 serve as part of the 32(?) digital outputs.

If by chance you would want to have it so that, say if your shooter is at 2000+ rpm and you want some LED’s to turn on, there are 6 analog inputs on the UNO and 16 on the MEGA.

I can’t help you on writing Java or C programs for it, though. I just use whatever language that is in the Arduino software (95% sure it’s called Sketch).







I was not the member who spearheaded the lights this year, but my close friend did. I will talk to him and our lead mentor to see if we are releasing the full code and scematics and, if so, when. I will get back to you on that soon.

Also, yes, those were the lights in question.

As evanperryg mentioned there are multiple ways of connecting the LEDs to the arduino.

If you only want to turn a few LEDs on and off, then wiring them directly to an arduino is the easiest way to go. Unfortunately it’s the most labor intensive as far as wiring goes. THe down side being that you’ll need 1 output pin on the arduino per LED unless you design some interfacing electronics to go with it.

If you want multicolor with lots of different patterns then you’re going to want to use an LED strip which is talked to over a serial protocol (like I2C for example). THis is the easiers option in my oppinion, especialyl since there are already libraries which handle the majority of the software. Wiring is simple, just 3 wires to conenct between the strip and the arduino.
Edit: I link to this in the other thread, but if you do go this route, there are plenty of good code examples for arduino alread.

I’ve described how to wire everything up in another thread recently

I can’t help you on writing Java or C programs for it, though. I just use whatever language that is in the Arduino software (95% sure it’s called Sketch).

The arduino programming language is based on C/C++. Sketches are what the project/program files are referred to.

Our driver and elecrical captain saw my previous posts and pointed out an Arduino use I forgot. This past year, we used an Arduino UNO and a stripped out RC controller to make a USB RC car controller for our driver. We used the Arduino as a form of a reverse USB Chicklet from the IFI days. The driver station recognised it as a PS3 controller, and programming was unaffected. I think we are putting together and Instructables How-to on it.

Using an Arduino in place of the Cypress board can remove some of the hassle. We are looking into other ways of using an Arduino for things other than LEDs. They are incredibly usefull as co-processors of all forms.

The LED’s are Shift Brite’s from SparkFun.

They are essentially 32-bit shift registers with 10-bit per color 3 color PWM controls (and 2 extra bits). So we chain them together and use 3 Arduino pins for all of the LED’s. We have the software setup for a 4x32bit chain, and there are 8 LED’s, so the second half of the string is a 1-cycle old mirror of the first half of the string.

The cRio uses 3x digital lines (relay 6,7,8 forward channel) to send a 3-bit command word to the Arduino. The lines are driven via a shift register in the DSC, and are high side driven, so we have pulldown resistors added also. I believe the arduino uses the 6v power supply on the digital sidecar but I could be wrong.

The cRio runs a state machine to get the command word (0-7) and outputs it on the 3 bit output. The Ardiuno turns the command word back into a number. The color of each of the 4 LEDs is defined for each mode, there is no further logic in the arduino now, although mode 0 used to fade between colors during disabled mode.

You can also program an arduino through labview.

[citation required]

Seriously, I don’t believe I’ve ever seen an Arduino that can run LabVIEW. I think you’re talking about the possibility of using LabVIEW on a PC to communicate with an Arduino running a specialized slave processor program.

My wording may have been incorrect…

The Arduino can be interfaced with labview using a direct usb cable or a wireless setup. Downloading the correct packages you may be able to put an xbee equipped Arduino on your robot and have it send info to a paired xbee connected by usb to a laptop which then could be accessed through a custom labview dashboard.

http://sine.ni.com/nips/cds/view/p/lang/en/nid/209835

Disclaimer: My former team did not work with controllers other than the crio on our robot so i do not know if this would be legal

Wireless communication other than using the bridge is not legal.

Thats what i thought but my team had no reason to think about the rule so i wasn’t sure.

You may also be able to use an arduino with ethernet capabilities

One option is to use LabVIEW to construct an Ethernet interface that is addressed to the Arduino Uno (you’d need the Ethernet shield).

Program the Arduino using the sketch editor and communicate with the cRIO using UDP.

If this works correctly, you should be able to use the Arduino in one of two configurations. In the slave configuration, you would do the LED programming in LabVIEW and tell the Arduino which pins to activate and at what rate. The other option would be to use LabVIEW to send data values to the Arduino to process and determine the LED pins and rates. There is also the third method, which would be a combination of both.