Content tagged with microcontroller

[MAKE] Fun with micro-controllers!

some Arduino PR - neither the project shown here nor the info are all that useful, but its a placeholder until i get some better howtos up -sd

258274162 4261Cfa009

Categories: | |

Arduino/Microcontroller Workshop #1

2006 Oct 16 - 5:00pm
2006 Oct 16 - 7:00pm
Etc/GMT-7

Microcontrollers for beginners, using the Arduino platform (bring yours!)

More Arduino resources

These five tutorials do a good job introducing
1. Blink an LED with Arduino
2. Reading a button
3. Read a variable resistor
4. Read a button and send to a PC and here is a super simple Processing program to receive

Categories: | | |

Arduino Tutorial: Read Button and Send Data to PC


/* Basic Digital Read
* ------------------
*
* turns on and off a light emitting diode(LED) connected to digital
* pin 13, when pressing a pushbutton attached to pin 7. It illustrates the
* concept of Active-Low, which consists in connecting buttons using a
* 1K to 10K pull-up resistor.
*
* Created 1 December 2005
* copyleft 2005 DojoDave
* http://arduino.berlios.de
*
*/

/* Sean Dockray added three lines to demonstrate sending button presses in to a PC! */

int ledPin = 13; // choose the pin for the LED
int inPin = 7; // choose the input pin (for a pushbutton)

Categories: | | |

Arduino Tutorial: Use PC to Blink an LED


/* Blinking LED (This code is for Arduino!)
* ------------
*
* turns on and off a light emitting diode(LED) connected to a digital
* pin, based on data coming over serial
*/

int ledPin = 13; // LED connected to digital pin 13
int inByte = 0;

void setup()
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
Serial.begin(19200); // initiate serial communication
}

void loop()
{
while (Serial.available()>0) {
inByte = Serial.read();
}
if (inByte>0) {
digitalWrite(ledPin, HIGH); // sets the LED on
} else {
digitalWrite(ledPin, LOW); // sets the LED off

Categories: | | |

Processing tutorial: Read button presses from Arduino

import processing.serial.*;

Serial port; // The serial port

void setup() {
size(200, 200);
println(Serial.list()); // list all available serial ports
port = new Serial(this, Serial.list()[2], 19200); // initialize serial communication
}

void draw() {
background(0);
while (port.available() > 0) { // while there are bytes available to read from the serial port
int inByte = port.read(); // read the byte
if (inByte==0) {
fill(255);
rect(width/4,height/4,width/2,height/2);
}
}
}

Categories: | | | |

Processing tutorial: Send data from program to Arduino


import processing.serial.*;

Serial port; // The serial port

void setup() {
size(200, 200);
println(Serial.list()); // list all available serial ports
port = new Serial(this, Serial.list()[2], 19200); // initialize serial communication
}

void draw() {
background(0);
if (mouseX>=width/4 && mouseX<=3*width/4 && mouseY>=height/4 && mouseY<=3*height/4) { // if the mouse is over the square
fill(0,255,0);
port.write(1); // write a 1 to the serial port
} else {
fill(255);
port.write(0); // write a 0 to the serial port (note: this is inefficient because we'll send lots of redundant data to the serial port... try to only do it when we're going to send a new value!)

Categories: | | |