Hi. i am running a python script that reads the incoming serial data from arduino and if the data is “yes” then it turns a pin on. and if it is “no” them it turns pin 0 low. Do i get rate limited for this if there is no deal in my circuit ? I thought that we don’t get rate limited for using the hardware serial method.
Here is the code:
Arduino:
#include <Ultrasonic.h>
Ultrasonic ultrasonic(12, 13);
int distance;
void setup() {
Serial.begin(9600);
}
void loop() {
distance = ultrasonic.read();
if (distance<20){
Serial.println(“yes”);
}
else{
Serial.println(“no”);
}
}
Python script:
from boltiot import Bolt #import necessary libraries
import conf, time #conf contains Bolt device id and API key, available from Bolt cloud dashboard
API_KEY = "MY API KEY. "
DEVICE_ID= “BOLTXXXX”
mybolt = Bolt(API_KEY, DEVICE_ID)
while True:
response = mybolt.serialRead(‘10’) #read serial data from arduino
print(response)
if response== “yes”:
mybolt.digitalWrite(‘0’, ‘HIGH’)
if response== “no”:
mybolt.digitalWrite(‘0’, ‘LOW’)