This workshop aims to teach participants into being confident creating a virtual Arduino circuit using Wokwi as an online simulator for hardware and coding. In addition participants will have an “Open-Eye” on many different aspects of coding, other than apps and software, to create a fun design and activity using Arduino
Projector/Screen, Laptop, Internet Access
Lesson Materials:
After attending this session, participants will gain:
This session depends a lot on discussion and student input and work.
A quick introduction about us and a way to break the Ice with the participant in order to engage with them in indirect way just to make a conversation and then a question to start the session.
Introduction & Icebreaking
1- Introduce yourself and Studio5.
2- ask about Arduino in general.
Presentation :
1- What is Arduino? introduce Wokwi
2- How to signup/login to Wokwi?
3- How to use Wokwi?
4- What are the extra features on Wokwi.
5- Who to create an Arduino based project with Arduino Uno, Buzzer and Potentiometer.
6- Let’s create the Happy Birthday Arduino circuit.
We will start by showing how to access Wokwi.
How to create project.
How to use component.
How to create C loops.
How to create C Arrays
How to manage the Arrays and Tones.
How to handle different song speed using Potentiometer.
How to create the final outcome, Happy Birthday Arduino Circuit (Demo Video)
int buzzerPin = 10;
int potPin = 0;
float potValue = 0.0;
float songSpeed = 1.0;
#define N_C4 262 //DO
#define N_D4 294 //RE
#define N_E4 330 //MI
#define N_F4 349 //FA
#define N_G4 392 //SOL
#define N_A4 440 //LA
#define N_B4 494 //SI
#define N_C5 523 //DO
#define N_D5 587 //RE
#define N_E5 659 //MI
#define N_F5 698 //FA
#define N_G5 784 //SOL
#define N_A5 880 //LA
#define N_B5 988 //SI
// G G A G C B — SOL SOL LA SOL DO SI
// G G A G D C — SOL SOL LA SOL RE DO
// G G G E C B A — SOL SOL SOL MI DO SI LA
// F F E C D C — FA FA MI DO RE DO
int b_day_notes[] = {
N_G4, 0, N_G4, N_A4, N_G4, 0, N_C5, N_B4, 0,
N_G4, 0, N_G4, N_A4, N_G4, 0, N_D5, N_C5, 0,
N_G4, 0, N_G4, N_G5, N_E5, N_C5, N_B4, N_A4, 0,
N_F5, 0, N_F5, N_E5, N_C5, N_D5, N_C5, 0
};
int note_duration[] = {
250, 125, 125, 500, 500, 25, 500, 500, 500,
250, 125, 125, 500, 500, 25, 500, 500, 500,
250, 125, 125, 500, 500, 500, 500, 500, 500,
250, 125, 125, 500, 500, 500, 500, 500
};
void setup()
{ potValue = analogRead(potPin);
songSpeed = mapfloat(potValue , 1, 1023, 0.7, 1.5);
}
void loop()
{
int totalNotes = sizeof(b_day_notes) / sizeof(int);
for (int i = 0; i < totalNotes; i++)
{ int currentNote = b_day_notes[i];
float wait = note_duration[i] / songSpeed;
potValue = analogRead(potPin);
songSpeed= mapfloat(potValue , 1, 1023, 0.7, 1.5);
if (currentNote != 0) // Play tone if current Note is not 0 HZ
{ // tone(pin, frequency, duration)
tone(buzzerPin, b_day_notes[i], wait); }
else
{ noTone(buzzerPin); }
delay(wait); // delay between tones
}
}
float mapfloat(float in_sensor, float in_min, float in_max, float out_min, float out_max)
{ return (in_sensor – in_min) * (out_max – out_min) / (in_max – in_min) + out_min;}
Having trouble? Let us know by completing the form below. We'll do our best to get your issues resolved quickly.
"*" indicates required fields