Skills Dev I: A Simple Internet Appliance
Made by Junke Zhao
Made by Junke Zhao
The project is going to create a preliminary appliance with a Particle Argon microcontroller.
Created: December 4th, 2023
The goal of this project is to build a basic IoT project using the Particle Argon microcontroller and complete some basic code projects such as controlling LED lights.
int led1 = D3;
void setup()
{
//Register Particle function
Particle.function("led", ledControl);
pinMode(led1, OUTPUT);
digitalWrite(led1, LOW);
}
int ledControl(String command)
{
int state = LOW;
if(command == "HIGH"){
state = HIGH;
}else if(command == "LOW"){
state = LOW;
}else{
return -1;
}
digitalWrite(led1, state);
return 1;
}
void loop() {
}
Click to Expand
int led1 = D3;
void setup()
{
//Register Particle function
Particle.function("led", ledControl);
pinMode(led1, OUTPUT);
digitalWrite(led1, LOW);
}
int ledControl(String times)
{
int n = times.toInt();
for (int i = 0; i<n; i++){
digitalWrite(led1, HIGH);
delay(500);
digitalWrite(led1, LOW);
delay(500);
}
digitalWrite(led1, LOW);
return 1;
}
void loop() {
}
Click to Expand
int led1 = D3;
int led2 = D2;
void setup()
{
//Register Particle function
Particle.function("led1", led1Control);
Particle.function("led2", led2Control);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
}
int led1Control(String command)
{
int state = LOW;
if(command == "HIGH"){
state = HIGH;
}else if(command == "LOW"){
state = LOW;
}else{
return -1;
}
digitalWrite(led1, state);
return 1;
}
int led2Control(String command)
{
int state = LOW;
if(command == "HIGH"){
state = HIGH;
}else if(command == "LOW"){
state = LOW;
}else{
return -1;
}
digitalWrite(led2, state);
return 1;
}
void loop() {
}
Click to Expand
In this section, I've learned basic skills to build a microcontroller developing environment, and also able to write basic functions to control the operation of the LEDs, including a way to transfer commands using Particle Cloud, and I'm exploring some other ways to run it.
In the process, I realized that it was important to keep the functions neat and easy to read, which would help keep things efficient as I added more features and equipment later.
A hands-on introductory course exploring the Internet of Things and connected product experiences.
The project is going to create a preliminary appliance with a Particle Argon microcontroller.