Axiometa Spark 1S
User Guide
This tutorial will guide you through all steps of setting up and using Axiometa Spark 1S
Setting Up
Code Example
Pinout Map
Schematics, 3D Models
Setting Up
Setting up the enviroment
PREREQUISITE!
- If you have not set up the Arduino IDE yet, check this tutorial for help.
- To install CP2102 Drivers, check this tutorial for help.
1
Unbox the Spark
2
Install CP2102 Drivers
3
Open Arduino IDE
4
Top Left, click "Select Board"
5
Connect Spark 1S to the PC
6
Select the COM port that has appeared
7
Search and Choose Arduino Uno, Click OK
8
Copy and paste a snippet from "Code Examples" Tab
9
Click Upload
10
Observe the board!
Code Example
Code copied!
/*
Example Code for Axiometa Spark 1S
===================================
Description: This example demonstrates the functionality of the Axiometa Spark 1S microcontroller,
featuring LED control, PWM fading, and an interrupt-driven button handler.
Features:
– Reads ambient light using an LDR and turns on/off an LED based on light levels.
– Smoothly fades a PWM-controlled LED.
– Detects button press using an interrupt and outputs a message to the Serial Monitor.
Pin Configuration:
– ACT_LED (Pin 13): Indicates low-light detection status.
– PWM_LED (Pin 10): PWM fading LED.
– BUTTON_PIN (Pin 2): Button for interrupt handling.
– LDR_PIN (Analog Pin A3): Light-dependent resistor for ambient light detection.
Author: Povilas Dumcius
Last Updated: 2024 January 11th
License: Open-source, for educational and prototyping purposes.
*/
#define ACT_LED 13 // Activity LED
#define PWM_LED 10 // PWM Capable LED
#define BUTTON_PIN 2 // Button pin
#define LDR_PIN A3 // LDR pin
void setup() {
// Initialize Serial communication at 9600 baud
Serial.begin(9600);
// Set pin modes
pinMode(ACT_LED, OUTPUT); // Configure ACT_LED pin as output
pinMode(PWM_LED, OUTPUT); // Configure PWM_LED pin as output
pinMode(BUTTON_PIN, INPUT); // Configure BUTTON_PIN as input
// Attach an interrupt to the button pin
attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), interruptHandler, FALLING);
// Perform startup LED blinking sequence
startupLED();
}
void loop() {
lightDetection(); // Monitor light levels and control ACT_LED
PWM(); // Perform PWM fading for PWM_LED
}
// Function to blink ACT_LED during startup
void startupLED() {
for (unsigned int i = 0; i < 5; i++) {
digitalWrite(ACT_LED, HIGH); // Turn on LED
delay(100); // Wait for 100 ms
digitalWrite(ACT_LED, LOW); // Turn off LED
delay(100); // Wait for 100 ms
}
}
// Function to detect light levels and control ACT_LED
void lightDetection() {
int dataLDR = analogRead(LDR_PIN); // Read LDR value
if (dataLDR > 400) { // Check if light is above threshold
digitalWrite(ACT_LED, HIGH); // Turn on ACT_LED
} else {
digitalWrite(ACT_LED, LOW); // Turn off ACT_LED
}
}
// Function to perform PWM fading on PWM_LED
void PWM() {
// Fade in
for (int fadeValue = 0; fadeValue <= 255; fadeValue += 15) {
analogWrite(PWM_LED, fadeValue); // Set PWM brightness
delay(30); // Wait for 30 ms
}
// Fade out
for (int fadeValue = 255; fadeValue >= 0; fadeValue -= 15) {
analogWrite(PWM_LED, fadeValue); // Set PWM brightness
delay(30); // Wait for 30 ms
}
}
// Interrupt Service Routine for BUTTON_PIN
void interruptHandler() {
Serial.println("Hello from Axiometa Spark – you pressed a button");
}
Pinout Map
Schematics, 3D Models
User Guide
Schematics, 3D Model
User Guide
Start Connecting
Make sure your microcontroller is prepared for uploading code
Explore the peripherals section for instructions and code examples.
Schematics, 3D Model