1958
Comentario:
|
2586
|
Los textos eliminados se marcan así. | Los textos añadidos se marcan así. |
Línea 30: | Línea 30: |
A este | {{{ // The Arduino code. #define ANALOG_IN 0 int ledPin = 13; // LED connected to digital pin 13 void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); // sets the digital pin as output } void loop() { int val = analogRead(ANALOG_IN); val=val/4; Serial.print( 0xff, BYTE); Serial.print( (val >> 8) & 0xff, BYTE); Serial.print( val & 0xff, BYTE); /* digitalWrite(ledPin, HIGH); // sets the LED on delay(1000); // waits for a second digitalWrite(ledPin, LOW); // sets the LED off delay(1000); // waits for a second */ } }}} |
Curso Sensibilización Hardware Libre (Unidad 002)
Tabla de Contenidos
002/02 Actividad 002
/ * Blink
* http://www.arduino.cc/en/Tutorial/Blink
*/
int potPin = 2; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int val = 0; // variable to store the value coming from the sensor
void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
}
void loop() {
val = analogRead(potPin); // read the value from the sensor
digitalWrite(ledPin, HIGH); // turn the ledPin on
delay(val); // stop the program for some time
digitalWrite(ledPin, LOW); // turn the ledPin off
delay(val); // stop the program for some time
}
// The Arduino code. #define ANALOG_IN 0 int ledPin = 13; // LED connected to digital pin 13 void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); // sets the digital pin as output } void loop() { int val = analogRead(ANALOG_IN); val=val/4; Serial.print( 0xff, BYTE); Serial.print( (val >> 8) & 0xff, BYTE); Serial.print( val & 0xff, BYTE); /* digitalWrite(ledPin, HIGH); // sets the LED on delay(1000); // waits for a second digitalWrite(ledPin, LOW); // sets the LED off delay(1000); // waits for a second */ }