Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 7

M9-Microprocessadores

Joel Ferreira nº4


Luís Santos nº5
Índice
 Material usado
 Circuito
 Códigos usados de base
 Código final
Material
 Breadboard
 Grove LED
 Grove rotary
 Arduino
 Jumpers
Circuito
Códigos base
Código
5 = 5 LEDs on
10 = all LEDs on
*/

#include <Grove_LED_Bar.h>

Grove_LED_Bar bar(9, 8, 1); // Clock pin, Data pin, Orientation


zSA
int sensorPin = A0; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
int leds = 0;

void setup()
{
Serial.begin(9600);

// nothing to initialize
bar.begin();
}

void loop()
{
sensorValue = analogRead(sensorPin);
leds = sensorValue/100;

Serial.println(leds);
bar.setLevel(leds);
delay(100);

/*
// Walk through the levels
for (int i = 0; i <= 10; i++)
{
bar.setLevel(i);
delay(100);
}
*/
}

You might also like