ברוכים הבאים לשיעור התשיעי!
השיעור מורכב מסדרה של סרטונים, צפו בהם לפי הסדר.
תהנו 🙂
#include <FastLED.h>
#define NUM_LEDS 16
#define DATA_PIN 33
CRGB leds[NUM_LEDS];
void setup() {
// put your setup code here, to run once:
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
}
void loop() {
// put your main code here, to run repeatedly:
leds[0] = CRGB::Red;
FastLED.show();
delay(30);
}
#include <FastLED.h>
#define NUM_LEDS 16
#define DATA_PIN 33
CRGB leds[NUM_LEDS];
void setup() {
// put your setup code here, to run once:
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
}
void loop() {
// put your main code here, to run repeatedly:
leds[0] = CRGB::Blue;
leds[4] = CRGB::Red;
leds[9] = CRGB::Pink;
FastLED.setBrightness(50);
FastLED.show();
delay(30);
}
void setup() {
// put your setup code here, to run once:
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
FastLED.setBrightness(50);
}
void loop() {
// put your main code here, to run repeatedly:
// Turn the first led red for 1 second
leds[0] = CRGB::Red;
FastLED.show();
delay(1000);
// Set the first led back to black for 1 second
leds[0] = CRGB::Black;
FastLED.show();
delay(1000);
}
#include <melody_player.h>
#include <melody_factory.h>
int buzzerPin = 14;
MelodyPlayer player(buzzerPin);
void setup() {
String notes[] = { "C4", "G3", "G3", "A3", "G3", "SILENCE", "B3", "C4" };
Melody melody = MelodyFactory.load("Nice Melody", 175, notes, 8);
player.play(melody);
}
void loop() {}
//Melody library
#include <melody_player.h>
#include <melody_factory.h>
int buzzerPin = 14;
MelodyPlayer player(buzzerPin);
//FastLED Library
#include <FastLED.h>
#define NUM_LEDS 16
#define DATA_PIN 33
CRGB leds[NUM_LEDS];
void setup() {
String notes[] = { "C4", "G3", "G3", "A3", "G3", "SILENCE", "B3", "C4" };
Melody melody = MelodyFactory.load("Nice Melody", 175, notes, 8);
player.play(melody);
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
FastLED.setBrightness(50);
}
void loop()
{
for(int dot = 0; dot < NUM_LEDS; dot++)
{
leds[dot] = CRGB::Red;
FastLED.show();
// clear this led for the next time around the loop
leds[dot] = CRGB::Black;
delay(30);
}
}