Adrián Torres
Published © CC BY-NC-SA

Fab Xiao

The Fab Xiao is a board created at the Fab Academy for any electronics or programming student to get started.

IntermediateProtip8 hours280
Fab Xiao

Things used in this project

Hardware components

Seeed Studio XIAO RP2040
Seeed Studio XIAO RP2040
×1
0Ω resistor
×1
499 Ω resistor 1206
×1
1kΩ resistor 1206
×1
LED 1206
×1
Button
×1
Female 1 row horizontal header 3
×1
Male 2 row vertical header
×1
Proto Board FR1
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

KiCAD files

Fab Xiao Schematic and board files

Code

Button + LED

Arduino
//Fab Academy 2023 - Fab Lab León
//Button + LED                           
//Fab-Xiao
//
//Original code:Neil Gershenfeld 12/8/19
// This work may be reproduced, modified, distributed,
// performed, and displayed for any purpose, but must
// acknowledge this project. Copyright is retained and
// must be preserved. The work is provided as is; no
// warranty is provided, and users accept all liability.
//

const int ledPin1 = 0;//first light  RP2040 pin 0 or ESP32-C3 pin D6 
const int buttonPin = 1;// button pin  RP2040 pin 1 or ESP32-C3 pin D7 
int buttonState = 0;//initial state of the button
int i = 0; //variable intensity led

void setup() { //declaration of inputs and outputs
  pinMode(ledPin1, OUTPUT);
  pinMode(buttonPin, INPUT);
}
void loop() {
  buttonState = digitalRead(buttonPin);// we read the state of the button
  if (buttonState == HIGH) { //if we press the button
  digitalWrite(ledPin1, HIGH);
  delay(500);                       
  digitalWrite(ledPin1, LOW);    
  delay(500);
  digitalWrite(ledPin1, HIGH);
  delay(500);                       
  digitalWrite(ledPin1, LOW);    
  delay(500);
  digitalWrite(ledPin1, HIGH);
  delay(2000);                        
  digitalWrite(ledPin1, LOW);    
  delay(1000);
  
}
  else {  //if we don't press the button
  digitalWrite(ledPin1, LOW);
  }
}

Credits

Adrián Torres
1 project • 2 followers
Contact

Comments

Please log in or sign up to comment.