tepukan jomok asoyy — Arduino Uno simulation

An interactive Arduino Uno circuit simulation you can run free in your browser on Velxio, by kiybiy36.

Components

Sketch code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Adafruit_NeoPixel.h>

// LED Ring configuration
#define PIN_LED       6    
#define NUM_LEDS     16    
Adafruit_NeoPixel lampu = Adafruit_NeoPixel(NUM_LEDS, PIN_LED, NEO_GRB + NEO_KHZ800);

// Standard I2C address initialization
LiquidCrystal_I2C lcd(0x27, 16, 2); 

void setup() {
  // Using the standard init() function forced by the libraries.txt lock
  lcd.init(); 
  lcd.backlight(); 
  
  lcd.setCursor(0, 0); 
  lcd.print("SMART LAMP SYSTEM");
  lcd.setCursor(0, 1); 
  lcd.print("Starting Up...");
  
  lampu.begin();
  lampu.setBrightness(100);
  setWarnaLampu(0, 0, 0); 
  
  delay(2000); 
  lcd.clear();
}

void loop() {
  // ANIMATION 1: GREEN
  lcd.setCursor(0, 0);
  lcd.print("STATUS LAMP: ON ");
  lcd.setCursor(0, 1);
  lcd.print("COLOR : GREEN  ");
  
  for(int i = 0; i < NUM_LEDS; i++) {
    lampu.setPixelColor(i, lampu.Color(0, 255, 0)); 
    lampu.show();
    delay(100); 
  }
  delay(1500); 
  
  // ANIMATION 2: BLUE
  lcd.setCursor(0, 0);
  lcd.print("STATUS LAMP: ON ");
  lcd.setCursor(0, 1);
  lcd.print("COLOR : BLUE   ");
  
  for(int i = 0; i < NUM_LEDS; i++) {
    lampu.setPixelColor(i, lampu.Color(0, 0, 255)); 
    lampu.show();
    delay(100);
  }
  delay(1500); 

  // ANIMATION 3: OFF
  lcd.setCursor(0, 0);
  lcd.print("STATUS LAMP: OFF");
  lcd.setCursor(0, 1);
  lcd.print("SYSTEM: STANDBY ");
  
  setWarnaLampu(0, 0, 0); 
  delay(2000); 
}

void setWarnaLampu(int r, int g, int b) {
  for(int i = 0; i < NUM_LEDS; i++) {
    lampu.setPixelColor(i, lampu.Color(r, g, b));
  }
  lampu.show(); 
}

More projects by kiybiy36