|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#13
|
||||
|
||||
|
Re: non-'FRC legal' control systems?
I think the arduino is easy enough for beginers, but its also expandable for more complex things. I took this example right from arduino's reference page. This example does exactly what i think your trying to do, read a pot and generate a pwm. I remember seeing a shield and an arduino clone that provided the standard 3 pin header like the ones found in the control system, but I don't know where to find them.
Code:
int ledPin = 9; // LED connected to digital pin 9
int analogPin = 3; // potentiometer connected to analog pin 3
int val = 0; // variable to store the read value
void setup()
{
pinMode(ledPin, OUTPUT); // sets the pin as output
}
void loop()
{
val = analogRead(analogPin); // read the input pin
analogWrite(ledPin, val / 4); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255
}
|
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| diversified systems at FRC Kickoff-NH | www.divsys.com | General Forum | 1 | 02-01-2008 19:34 |
| Motor Control Systems | Astronouth7303 | Programming | 3 | 05-04-2005 19:35 |
| Control Systems | dbeck103 | General Forum | 2 | 30-09-2003 12:49 |
| Control Systems | archiver | 2000 | 1 | 23-06-2002 22:15 |
| It's Raining Control Systems | CaptainPlaid | Technical Discussion | 6 | 24-03-2002 15:32 |