Surilli
Published © GPL3+

Blinking an LED Using Surilli Basic M0 and a Push Button

Turn an LED ON/OFF by integrating your Surilli Basic M0 with a push button.

BeginnerFull instructions provided15 minutes630
Blinking an LED Using Surilli Basic M0 and a Push Button

Things used in this project

Hardware components

Surilli Basic
Surilli Basic
×1
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
LED (generic)
LED (generic)
×1
Resistor 220 ohm
Resistor 220 ohm
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Surilli Basic M0 with LED and Push Button

Code

SurilliBasicM0_LED_PushButton

C/C++
// Set pin numbers

const int ledPin = 13;         // Const won't change
const int buttonPin = 9;
 
// Variables will change

int buttonState = 0;          // Variables for reading the pushbutton status
 
void setup() 
{
  
 
         SerialUSB.begin(9600);
         pinMode(ledPin, OUTPUT);    // Initialize the LED pin as an output
         pinMode(buttonPin, INPUT);  // Initialize the pushbutton pin as an output
  
}
 
void loop() 

{
 
        buttonState = digitalRead(buttonPin); // Read the state of the pushbutton value
 
        if (buttonState == HIGH) 
        {            
              // Check if the pushbutton is pressed
              // If it is, the buttonState is HIGH
              digitalWrite(ledPin, HIGH);         // Turn LED on    
              SerialUSB.println("LED ON"); 
        
        }
  
       else 
       {
 
             digitalWrite(ledPin, LOW);          // Turn LED off
             SerialUSB.println("LED OFF");
       }
       
}

Credits

Surilli

Surilli

196 projects • 62 followers
Surilli is a premiere Internet of Things centric Technology Company aimed at providing cutting edge innovative solutions.

Comments