A
@maamar
i've a strange behaviour:
main.py
from pysense import Pysense
from MPL3115A2 import MPL3115A2
from SI7006A20 import SI7006A20
from LTR329ALS01 import LTR329ALS01
from network import Sigfox
import socket
import time
import struct
import network
wlan = network.WLAN();
wlan.deinit();
while True:
py = Pysense();
mp = MPL3115A2();
si = SI7006A20();
lt = LTR329ALS01();
sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1);
#temperature -10000 - 10000
temp = int(round(si.temperature()*100,2));
#humidity 10000 - 0
hum = int(round(si.humidity()*100,0));
#pressure -13000 - 8560
pres = int(round(mp.pressure(),0))-100000;
#blue light
blue = lt.light()[0];
#red light
red = lt.light()[1];
#message
message = bytes(struct.pack('>hhhhh',temp,hum,pres,blue,red));
s = socket.socket(socket.AF_SIGFOX, socket.SOCK_RAW);
s.setblocking(True);
s.setsockopt(socket.SOL_SIGFOX, socket.SO_RX, False);
s.send(message);
s.close();
py.setup_sleep(60);
py.go_to_sleep();
If i supply the pysense by usb all works fine, but if i supply it by 5V and GND (first and second pin on the top rigth corner) the Sipy sends only one message.
Do you have any suggestions?