Ruchir Sharma
Published © GPL3+

Getting Started with Particle Argon and Xenon

How to set up the Argon and Xenon.

EasyFull instructions provided1 hour406
Getting Started with Particle Argon and Xenon

Things used in this project

Hardware components

Argon
Particle Argon
×1
Xenon
Particle Xenon
×1
Breadboard (generic)
Breadboard (generic)
×1
LED (generic)
LED (generic)
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE

Story

Read more

Code

Blink an LED

Arduino
Used in both Argon and Xenon
// First, we're going to make some variables.


int led1 = D2; 
int led2 = D7; 

// Having declared these variables, let's move on to the setup function.
// The setup function is a standard part of any microcontroller program.
// It runs only once when the device boots up or is reset.

void setup() {

  // We are going to tell our device that D0 and D7 (which we named led1 and led2 respectively) are going to be output
  // (That means that we will be sending voltage to them, rather than monitoring voltage that comes from them)

  // It's important you do this here, inside the setup() function rather than outside it or in the loop function.

  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);

}

// Next we have the loop function, the other essential part of a microcontroller program.
// This routine gets repeated over and over, as quickly as possible and as many times as possible, after the setup function is called.
// Note: Code that blocks for too long (like more than 5 seconds), can make weird things happen (like dropping the network connection).  The built-in delay function shown below safely interleaves required background activity, so arbitrarily long delays can safely be done if you need them.

void loop() {
  // To blink the LED, first we'll turn it on...
  digitalWrite(led1, HIGH);
  digitalWrite(led2, HIGH);

  // We'll leave it on for 1 second...
  delay(1000);

  // Then we'll turn it off...
  digitalWrite(led1, LOW);
  digitalWrite(led2, LOW);

  // Wait 1 second...
  delay(1000);

  // And repeat!
}

Blink an LED1.zip

Arduino
Used in both devices
No preview (download only).

Login page

HTML
<html>
<head>
<title>Login Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>

<body bgcolor = #40E0D0>


<i class="fa fa-mobile" style="font-size:48px;color:red"></i>
<i class="fa fa-wifi" style="font-size:48px;color:red"></i>
<i class="material-icons" style="font-size:48px;color:red">bluetooth_connected</i>
<i class="fa fa-cloud" style="font-size:48px;color:red"></i>
<br>

 
<form name="loginForm" method="post" action="Particle.html">
<table width="20%" bgcolor="0099CC" align="center">

<tr>
<td colspan=2><center><font size=4><b>Login Page</b></font></center></td>
</tr>

<tr>
<td>Username:</td>
<td><input type="text" size=25 name="userid"></td>
</tr>

<tr>
<td>Password:</td>
<td><input type="Password" size=25 name="pwd"></td>
</tr>


<tr>
<td ><input type="Reset"></td>
<td><input type="submit" onclick="return check(this.form)" value="Login"></td>
</tr>

</table>
</form>
<script language="javascript">
function check(form)
{

if(form.userid.value == "default" && form.pwd.value == "default")
{
	return true;
	
}
else
{
	alert("Error, Enter valid Username or Password")
	return false;
}
}
</script>

</body>
</html>

LED control page

HTML
<!DOCTYPE>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
 <img src="index.png" style="max-width:100%;height:auto;">
<br>
 <center>
  <br>
  <br>
  <br>
  <form action="https://api.particle.io/v1/devices/e00fce68857de2ce3bcda922/cloud_led?access_token=6c1e60f7bc502028dee2df04e148b351d7f74f2f" method="POST">
    Control LED from the cloud<br>
    <br>
    <input type="radio" name="arg" value="on">Turn the LED on.
    <br>
    <input type="radio" name="arg" value="off">Turn the LED off.
    <br>
    <br>
    <input type="submit" value="Submit">
  </form>
  </center>
  </body>
</html>

Credits

Ruchir Sharma

Ruchir Sharma

4 projects • 91 followers

Comments

Add projectSign up / Login