LED KETUPAT RAYA WITH MAKER UNO

Make your own LED ketupat today!

Introduction

Celebrate Hari Raya Aidilfitri with this LED ketupat and Maker UNO playing Suasana Hari Raya melody🎶🎵. With a few components, you can enlighten your Hari Raya Aidilfitri.

Video

Watch this video for more info on how to make LED Ketupat Raya with Maker UNO.

This is the hardware connection and the components needed.

Sample Code

Please paste this sample code inside the toneMelody sketch. Go to File > Examples > 02.Digital > toneMelody.

/*
* This code will play a melody – Suasana Hari Raya https://www.youtube.com/watch?v=NbxbdmntX58
* using Maker Uno.
*
* Maker Uno: https://www.cytron.io/p-maker-uno
*
* Created by:
* 6 June 2018 Idris Cytron Technologies
*/
#include "pitches.h"
#define BUZZER 8
#define TEMPO 1600
int pin = 0;
// notes in the melody:
int melody[] = {
NOTE_FS5, 0, NOTE_FS5, NOTE_G5, 0, NOTE_A5, 0, NOTE_B5, NOTE_A5, NOTE_B5, NOTE_A5,
NOTE_G5, NOTE_FS5, NOTE_G5, NOTE_FS5, NOTE_E5, NOTE_E5, NOTE_E5, NOTE_FS5, NOTE_G5, 0,
NOTE_G5, NOTE_E5, NOTE_FS5, NOTE_G5, NOTE_FS5, NOTE_G5, NOTE_A5, 0, 0,
NOTE_FS5, 0, NOTE_FS5, NOTE_G5, 0, NOTE_A5, 0, NOTE_B5, NOTE_A5, NOTE_B5, NOTE_A5,
NOTE_G5, NOTE_FS5, NOTE_G5, NOTE_FS5, NOTE_E5, NOTE_E5, NOTE_E5, NOTE_D5, NOTE_CS5,
0, NOTE_D5, NOTE_D5, 0, 0, 0,
NOTE_FS5, 0, NOTE_FS5, NOTE_G5, 0, NOTE_A5, 0, NOTE_B5, NOTE_A5, NOTE_B5, NOTE_A5,
NOTE_G5, NOTE_FS5, NOTE_G5, NOTE_FS5, NOTE_E5, NOTE_E5, NOTE_E5, NOTE_FS5, NOTE_G5, 0,
NOTE_G5, NOTE_E5, NOTE_FS5, NOTE_G5, NOTE_FS5, NOTE_G5, NOTE_A5, 0, 0,
NOTE_FS5, 0, NOTE_FS5, NOTE_G5, 0, NOTE_A5, 0, NOTE_B5, NOTE_A5, NOTE_B5, NOTE_A5,
NOTE_G5, NOTE_FS5, NOTE_G5, NOTE_FS5, NOTE_E5, NOTE_E5, NOTE_E5, NOTE_D5, NOTE_CS5,
0, NOTE_D5, NOTE_D5, 0, 0,
};
// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 4, 4, 8, // 30
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 4,
8, 8, 4, 4, 8, 2, // 26
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 4, 4, 8, // 30
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 4,
8, 8, 4, 4, 8, // 25
};
void setup()
{
for (pin = 2; pin < 14; pin++) {
pinMode(pin, OUTPUT);
}
delay(500);
for (pin = 2; pin < 8; pin++) {
digitalWrite(pin, HIGH);
delay(200);
}
delay(500);
// iterate over the notes of the melody:
for (int thisNote = 0; thisNote < 111; thisNote++) {
// to calculate the note duration, take one second divided by the note type.
//e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
int noteDuration = TEMPO / noteDurations[thisNote];
tone(BUZZER, melody[thisNote], noteDuration);
if (melody[thisNote] == 0) {
LEDs(LOW);
}
else {
LEDs(HIGH);
}
// to distinguish the notes, set a minimum time between them.
// the note's duration + 30% seems to work well:
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
// stop the tone playing:
noTone(BUZZER);
}
}
void loop()
{
}
void LEDs(boolean ledArray)
{
if (ledArray == HIGH) {
for (pin = 2; pin < 8; pin++) {
digitalWrite(pin, LOW);
}
for (pin = 9; pin < 14; pin++) {
digitalWrite(pin, HIGH);
}
}
else {
for (pin = 2; pin < 8; pin++) {
digitalWrite(pin, HIGH);
}
for (pin = 9; pin < 14; pin++) {
digitalWrite(pin, LOW);
}
}
}

view raw
LEDketupat.ino
hosted with ❤ by GitHub

Reference

How to make ketupat.

Thank you

Thank you for reading this tutorial and we hope it helps your project development. If you have any technical inquiries, please post at Cytron Technical Forum.

4 thoughts on “LED KETUPAT RAYA WITH MAKER UNO”

  1. hi, kenapa bila saya nak upload kod saya ke maker uno, dlm sketch tu kata , ‘can’t open com 3’ lepastu saya tukar balik no. com saya iaitu com 5 dan upload tapi dia ttp kata ‘can’t open com 5’ kenapa ya?

  2. Saya dah cuba!

    Cuma nak tanya, kalau lebih dari 2 LED macam mana? boleh sambung LED selari?

  3. Waalaikumussalam Puan Kamsina, Puan boleh mula menulis coding dari nombor 11.. dari 1 sehingga 10 adalah nota sahaja 🙂

  4. KAMSINA BINTI HAJI JUNAIDI

    Assalamualaikum,
    Puan Suad,
    Saya nak tanya, coding di atas tu, kita type sekali drp no 1 kah ?

    Tqvm.

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

Raspberry Pi Pico VS Arduino MKRZero
Raspberry Pi Pico VS Teensy LC
A New Challenger in MCU Platform – Raspberry Pi Pico
Raspberry Pi Pico VS Arduino UNO
Raspberry Pi Pico VS micro:bit V2
Scroll to Top