Arnov Sharma
Published © MIT

PCB Hotplate V3

XIAO ESP32 C3 Powered PCB Hotplate

BeginnerFull instructions provided3 hours825
PCB Hotplate V3

Things used in this project

Hardware components

Seeed Studio xiao esp32 c3
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Seeed Studio Fusion PCB/PCBA
Seeed Studio Fusion PCB/PCBA

Story

Read more

Schematics

sch

Code

code

C/C++
int switchPin = D1;     //4         
int led1Pin = D0;        //0

int pinsCount=9;                        // declaring the integer variable pinsCount
int pins[] = {D2,D3,D4,D5,D6,D7,D8,D9};  

int val;                        
int val2;                       
int buttonState;                
int Mode ; //= 0;              

void setup() 
{
pinMode(switchPin, INPUT_PULLUP);    
pinMode(led1Pin, OUTPUT);

  pinMode(D9, OUTPUT);
  pinMode(D2, OUTPUT);
  pinMode(D3, OUTPUT);
  pinMode(D4, OUTPUT);
  pinMode(D5, OUTPUT);
  pinMode(D6, OUTPUT);
  pinMode(D7, OUTPUT);
  pinMode(D8, OUTPUT);


buttonState = digitalRead(switchPin); 
}

void loop(){
 
      val = digitalRead(switchPin);      // read input value and store it in val
      delay(10);                         // 10 milliseconds is a good amount of time
      val2 = digitalRead(switchPin);     // read the input again to check for bounces
      
      if (val == val2) {                 // make sure we got 2 consistant readings!
        if (val != buttonState) {          // the button state has changed!
          if (val == HIGH) {                // check if the button is pressed
            if (Mode == 0) {         
              Mode = 1;               
            } else {
                if (Mode == 1) {       
                Mode = 0;           
            } 
       }
      }
        buttonState = val;                 // save the new state in our variable
      }

      // Now do whatever the lightMode indicates
      if (Mode == 0) {                       // FLIP FLOP
        digitalWrite(led1Pin, LOW);
      }

      if (Mode == 1) {
        digitalWrite(led1Pin, HIGH);   //HIGH
   Chase();
      }
}
}

void Chase (void)
{
    for (int i=0; i<pinsCount; i=i+1){    // chasing right
    digitalWrite(pins[i], HIGH);         // switching the LED at index i on
    delay(100);                          // stopping the program for 100 milliseconds
    digitalWrite(pins[i], LOW);          // switching the LED at index i off
  }

}
  

Credits

Arnov Sharma

Arnov Sharma

310 projects • 309 followers
Just your average MAKER

Comments