A Simple Internet Appliance
Made by Yiming Jiao
Made by Yiming Jiao
Start to learning the basic function of Argon and cloud function.
Created: November 2nd, 2023
As above picture, this is an introductory skill build documentation. I learnt how Argon work through particle, and how cloud function work.
const int LEDPIN0 = D0;
void setup() {
pinMode(LEDPIN0, OUTPUT);
//Making a Connected LED
digitalWrite(LEDPIN0, LOW);
Particle.function("led", ledControl);
}
void loop() {
}
//Making a Connected LED
//Ex.1
int ledControl(String command)
{
for(int i = 0; i < 3; i++){
digitalWrite(LEDPIN0, HIGH);
delay(500);
digitalWrite(LEDPIN0, LOW);
delay(500);
}
return 1;
}
Click to Expand
const int LEDPIN0 = D0;
void setup() {
pinMode(LEDPIN0, OUTPUT);
//Making a Connected LED
digitalWrite(LEDPIN0, LOW);
Particle.function("led", ledControl);
}
void loop() {
}
//Making a Connected LED
//Ex.2
int ledControl1(String num)
{
int n = num.toInt();
for(int i = 0; i < n; i++){
digitalWrite(LEDPIN0, HIGH);
delay(500);
digitalWrite(LEDPIN0, LOW);
delay(500);
}
return 1;
}
Click to Expand
const int LEDPIN0 = D0;
const int LEDPIN1 = D1;
void setup() {
pinMode(LEDPIN0, OUTPUT);
pinMode(LEDPIN1, OUTPUT);
//Making a Connected LED
digitalWrite(LEDPIN0, LOW);
Particle.function("led", ledControl);
}
void loop() {
}
int ledControl2(String command)
{
int state = LOW;
// find out the state of the led
if(command == "HIGH"){
state = HIGH;
}else if(command == "LOW"){
state = LOW;
}else{
return -1;
}
// write to the appropriate pin
digitalWrite(LEDPIN0, state);
digitalWrite(LEDPIN1, state);
return 1;
}
Click to Expand
A hands-on introductory course exploring the Internet of Things and connected product experiences.
Start to learning the basic function of Argon and cloud function.