while (!Serial.available()){
delay(1000);
return;
}
a little rough just to see if it would work but no ): code still doesn’t start running
and btw, the proyect I’m working on is that since the will be connected to the camera and a door solenoid in a wall outside a house, so when someone comes visit, the core send me a pic of the person via wifi and then I tell the core to open the door, how will I be able to send the data over wifi if I can’t make work manually and over the usb serial? ):
also replaced the port for a smaller one, I was reading the code and says something about an SD, is that the only way I can transfer this data to see the actual picture?
You can use a lot of different routes to transfer, but an SD might be good to have for buffering at least.
Once you got the pic read and buffered, you can start the WiFi and transfer the data via TCP or just use wire.
For your intended use, time might become an issue, depending on the img size. 640x400 does take a while to transfer from cam to Core via serial plus publishing it whatever way
import binascii
f = open ("outputData5.txt","r")
nf = open("binaryData5.jpg","wb")
//Read whole file into data
while 1:
c = f.readline()
d = c.strip()
if not c:
break
nf.write(binascii.a2b_hex(d))
//Close the file
f.close()
nf.close()
but then gave me this error:
"Traceback (most recent call last):
File "convert.py", line 12, in <module>
nf.write(binascii.a2b_hex(d))
TypeError: Odd-length string"
please format your code by wrapping it an blocks of
Hello guys, got some extra time for my project and now I can’t seam to make this code work:
import binascii
import serial
nf = open("new1.jpg","wb")
ser = serial.Serial('/dev/cu.usbmodem1411', 9600) # Establish the connection on a specific port
while 1:
c = ser.read() # Read the newest output from the Arduino
if not c:
break
print(c)
nf.write(binascii.a2b_hex(c))
//Close the file
nf.close()
it’s supposed to get the info from particle serial monitor and convert the image by itself, but nothing happens when I run this code, but if I type “particle serial monitor” on the command line, the image starts to appear. Any ideas? @kennethlimcp@ScruffR
Hello @kennethlimcp my spark has been flashing green, not connecting to ANY network which never happened before, already tried installing the firmware again and nothing works, any ideas?
I tried and somehow when I request the serial monitor before I flash the code from the cloud it works fine, but once I flash the code and then ask for the particle serial monitor gives me the error “! serial: No devices available via serial” while the core is still connected…
You won’t see the port if it’s not opened by the device via Serial.begin(). (At least true for the Core FW 0.3.4, the Photon does open the USB serial by default)
I’ve seen some other things in your code
//pinMode(button, INPUT); // declare pushbutton as input
pinMode(button, INPUT_PULLDOWN); // required unless you have an
// external pull down resistor
// otherwise your pin might float
// giving you wrong readings
You are using SYSTEM_MODE(MANUAL) but also declaring a Spark.function(), why?
When using a TCPClient in MANUAL, you’d need to call WiFi.connect() to have it work.
How do you flash your code from the cloud when your Core is in MANUAL mode (without connection to the cloud anywhere)?.