Hi All,
The steps are simple. Here I am connecting my IOT Device Arduino with Python
Connect Python and Arduino
At First Run Arduino and select COM3 as port
with LDR Program
------------------------------------------------------------------------------
const int ldr = 0; //A0 assigned as LDR pin.
int value = 0; //Store values from LDR.
void setup()
{
Serial.begin(9600); //Fix serial baud rate at 9600bps
}
void loop()
{
value = analogRead(ldr); //Read the analog values from LDR. or simply use value=999
Serial.println(value); //Print to serial monitor.
delay(250); //Delay of 250 milliseconds (1/4th of a second).
}
------------------------------------------------------------------------------
Then in the Python
install serial first.
then type this command
------------------------------------------------------------------------------
import time;
ser = serial.Serial('COM3', 9600, timeout=0,parity=serial.PARITY_EVEN, rtscts=1)
while True:
s=ser.read();
print(s);
time.sleep(3);
------------------------------------------------------------------------------
The steps are simple. Here I am connecting my IOT Device Arduino with Python
Connect Python and Arduino
At First Run Arduino and select COM3 as port
with LDR Program
------------------------------------------------------------------------------
const int ldr = 0; //A0 assigned as LDR pin.
int value = 0; //Store values from LDR.
void setup()
{
Serial.begin(9600); //Fix serial baud rate at 9600bps
}
void loop()
{
value = analogRead(ldr); //Read the analog values from LDR. or simply use value=999
Serial.println(value); //Print to serial monitor.
delay(250); //Delay of 250 milliseconds (1/4th of a second).
}
------------------------------------------------------------------------------
Then in the Python
install serial first.
then type this command
------------------------------------------------------------------------------
import time;
ser = serial.Serial('COM3', 9600, timeout=0,parity=serial.PARITY_EVEN, rtscts=1)
while True:
s=ser.read();
print(s);
time.sleep(3);
------------------------------------------------------------------------------
If you are interested to learn more about the most sophisticated players in the outsourced product development industry, I'd highly recommend checking out this list of the best product development companies .
ReplyDelete