void setup() {  // initialize the digital pin as an output.  // Pin 13 has an LED connected on most Arduino boards:  pinMo...
void setup() {  // initialize the digital pin as an output.  // Pin 13 has an LED connected on most Arduino boards:  pinMo...
int brightness = 0;int fadeAmount = 5;void setup() {  pinMode(9, OUTPUT);}void loop() {  // set the brightness of pin 9:  ...
const int buttonPin = 2;const int ledPin = 13;int buttonState = 0;void setup() {  pinMode(ledPin, OUTPUT);  pinMode(button...
const int sensorPin = A0;const int ledPin = 9;void setup() {  pinMode(ledPin, OUTPUT);}void loop() {  // read the value fr...
const int ledPin = 9;void setup() {  // initialize the serial communication:  Serial.begin(9600);    pinMode(ledPin, OUTPU...
import processing.serial.*;Serial port;void setup() {  size(256, 150);    // Print available serial ports    println(Seria...
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
Upcoming SlideShare
Loading in...5
×

Arduino Workshop 2011.05.31

1,524

Published on

Published in: Design
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,524
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
81
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Arduino Workshop 2011.05.31"

  1. 1. void setup() { // initialize the digital pin as an output. // Pin 13 has an LED connected on most Arduino boards: pinMode(13, OUTPUT);}void loop() { digitalWrite(13, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(13, LOW); // set the LED off delay(1000); // wait for a second}
  2. 2. void setup() { // initialize the digital pin as an output. // Pin 13 has an LED connected on most Arduino boards: pinMode(13, OUTPUT);}void loop() { digitalWrite(13, HIGH); // set the LED on delay(1000); // wait for a second digitalWrite(13, LOW); // set the LED off delay(1000); // wait for a second}
  3. 3. int brightness = 0;int fadeAmount = 5;void setup() { pinMode(9, OUTPUT);}void loop() { // set the brightness of pin 9: analogWrite(9, brightness); brightness = brightness + fadeAmount; if (brightness == 0 || brightness == 255) { fadeAmount = -fadeAmount ; } delay(30);}
  4. 4. const int buttonPin = 2;const int ledPin = 13;int buttonState = 0;void setup() { pinMode(ledPin, OUTPUT); pinMode(buttonPin, INPUT);}void loop(){ // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); if (buttonState == HIGH) { digitalWrite(ledPin, HIGH); } else { digitalWrite(ledPin, LOW); }}
  5. 5. const int sensorPin = A0;const int ledPin = 9;void setup() { pinMode(ledPin, OUTPUT);}void loop() { // read the value from the sensor: int sensorValue = analogRead(sensorPin); // scale from 0-1023 to 0-255 int intensity = map(sensorValue, 0, 1023, 0, 255); // sets the value analogWrite(ledPin, intensity);}
  6. 6. const int ledPin = 9;void setup() { // initialize the serial communication: Serial.begin(9600); pinMode(ledPin, OUTPUT);}void loop() { byte brightness; // check if data has been sent from the computer: if (Serial.available()) { // read the most recent byte (0-255) brightness = Serial.read(); // set the brightness of the LED: analogWrite(ledPin, brightness); }}
  7. 7. import processing.serial.*;Serial port;void setup() { size(256, 150); // Print available serial ports println(Serial.list()); port = new Serial(this, "COM1", 9600);}void draw() { // draw a gradient from black to white ... // send the current X-position of the mouse port.write(mouseX);}
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×