#microcontrollers
1 messages · Page 28 of 1
Basically after i write my certificate to the board i want to wait to wait for 'OK' to show up which sometimes comes after couples of lines and has passed and sometime come in the next line
And it always comes at the starting of the string
Hi, is there any way to run micropython on windows? or mock a device? I'm looking to create a micropython project that uses a screen and some buttons, but wish to share that code with a windows application also (data synced across cloud).
Basically is there a way I can do micropython development on a windows device for testing before I actually hook up the hardware?
python printed: AT+CGREG=?
python printed: +CGREG: (0,1,2)
python printed:
python printed: OK```
how can i chk if ok comes in first five lines of the output @opal lodge
if 'OK' in response:
value = response.split(':")[1]
print response```
cant i do this
i would do a bit more checking than that to not get any false positives
do you know if "OK" will be on it's own line without any other characters other then the newline character(s) after it?
it will basically be in terminal
as output
i am wanna chk the resposne of command
which show show OK as output in like first 5-7 lines or show error
than process was failed
basically it is the command
but i need to chk first five lines if it contains ok or what if give error
i think i'd implement the whole thing like this: https://paste.pythondiscord.com/ovenayuwav.py (new version)
@opal lodge
how can i resolve thiis
mkdir shows error if folder already exist
i want to hide or you can say supress it
i think this is quite off-topic for this channel and i'm really not the right person as i've been a full time linux user for many years
i also don't like microsoft and their products very much (vs code might be an exception) and really loafhe powershell
but if it's anything like unix/linux i would say add a -f on the command line to "force" it
thanks dude for the help
i actually soved it using -p
@soft marten have you tried this script yet?
i cant my board is burnt
so i am making changes to the script for now
is there a way to get user variables
????
wow, sad to hear
how did that happen?
i dont know actually
lol
someelse took it
how do you mean, on the command line or what kind of interaction are you thinking of?
yup
command line
i want to get user python
like parameters?
oh, environment variables, not command line parameters/arguments ✅
probably off-topic as well, but check out https://docs.python.org/3/library/os.html#os.environ
import os
print(os.environ['PATH'])
print(os.environ['HOME'])
for key, value in os.environ.items():
print(f"{key}: {value}")
i am trying to pass dynamic address to my script
string output is same
but still it shows in no such file exist
@opal lodge
lines = []
response = ""
while True:
response += self._serial.readline().decode("utf-8")
if response.endswith(("\r", "\n", "\r\n")):
response = response.strip()
lines.append(response)
if response == "OK":
return lines
if self.error_response.match(response):
raise AtCommandError(lines)
response = ""
time.sleep(0.1)
dude in your code how mnay lines are you reading
if you dont get ok what will you do
@opal lodge
i am counting on always getting at least one line with "OK" and bail out or one of the three error patterns documented on their site: https://infocenter.nordicsemi.com/topic/ref_at_commands/REF/at_commands/at_syntax_response.html
i skipped implementing a hard timeout but can be implemented as well if needed, was just doing something quick
according to their documentation it seems like one can count on always getting one of those four responses eventually
i noticed it was necessary to implement a buffer in the software because of the timeout set to the serial library or else a line could be cut somewhere in between and it wouldn't match anything, hence how some of it is implemented
i also built you two functions to read a file from disk in a slightly better way as well as being able to remove crap before and after in the file and only extract the certificate, private key or whatever else that is pem encoded, it should follow all the rules of the pem specification to be versatile
i also built a little example for how you could get the imei number from the device if you're want to read it from the device, just need to process the output a bit
otherwise the class and the two functions should be ready to use as they are and you can build upon it
how can i implement a function getresponse()
to chk first reponse for first 5 times
i was actually tthinking to implement while loop
for 5 times
Hello, i currently have a raspberry pi pico witha laser wired in to the uart pins and i need to write a byte array to the laser to tell it to turn on anyone have an idea on how i would do this?
have you checked their documentation? https://docs.micropython.org/en/latest/rp2/quickref.html#uart-serial-bus
we can surely modify the code a bit to do that as well as an option
maybe even take the time to add proper timeouts to it as well as another option
ah, i think we could just patch it in so that it's an option to just add functionality to it
The problem is when the code will not run
Due to errors
Or gives ouput with delay
Lets say it gives output after 4 sec
Than there could issue of buffer
not with the code that was there originally, that would only get problems if they didn't follow their own specifications or something really bad happens like if it dies or gets disconnected
guys is microsd card required for raspberry pi?
or can i just boot it using a pendrive?
?
is there a way to pass info from python script directly to ardunio
arduino program*
so like select options in python gui and pass that to the C program
and when arduino ide compiles it it has access to the stuff from the python script
no, you need it, the microsd card is like the ssd of the raspberry
with a raspberry pi 4 (and 400) with modern firmware you can boot from either usb or network (pxe) without a microsd card
this is possible now because the raspberry pi 4 (and 400) has a larger onboard firmware that you can even update
not so, not with the raspberry pi 4 and 400, see above
The pinned post in this channel goes in more depth, but the answer is that something similar can be done, but you'll probably want to just have the python program send commands via serial to the arduino. There's also PyFirmata https://github.com/tino/pyFirmata which might help you do it
Ohh ok
Thank you @opal lodge
yo im trying to get into raspberry pi, and i was wondering if u guys know how i can use my laptop display to control the raspberry pi. my goal is to make a simple program with the gpio turning an led on and off
You can try follow this instruction https://www.youtube.com/watch?v=NWBmYnNvN3A
VNC Viewer is a way for you to access and control your Raspberry Pi desktop from another computer such as a Mac or Windows machine. And the best part is that VNC Viewer is free.
Pre-Requisite for Raspberry Pi users: Install Raspberry Pi OS
If you're not familiar with Raspberry Pi OS, please see my video here: https://youtu.be/2Jfv9NO6J2Q
Ra...
you could setup your raspberry pi in headless mode and just ssh and vnc into it
you might also need an extra monitor or tv with hdmi input and a keyboard that you can connect to the raspberry if you need to troubleshoot bootup issues
if that isn't available to you, a ttl-to-usb cable can be used if the needed GPIO pins aren't occupied by a hat or something else
if you only need to use the laptop screen as a monitor for the raspberry pi you could get a hdmi-to-usb capture card (not to be confused with a usb-to-htmi display adapter) but this only gets you half way as in itself it don't give you a keyboard for the raspberry pi
Anyone here using a Raspberry Pi Pico? What's your use-case for it?
hello every i am a student in 10th grade and i have a competition in which i am making an AI that moves. so here is my problem i have done lots of researches but i didn't find anything to help me, i am trying to control my Arduino code with python so i can make it a fully independent but i have very little experience with Arduino and i see it hard i don't really know but please if anyone can help me just text me thanks (i know i might be asking this question in the wrong place but please just help me).
ping me please
pico people in the house?
Github
Where you use a githook whenever something is committed, it updates
I’m looking for a wireless button on batteries to toggle my lights. I’ve used a bluetooth remote button before, but this sucks since: to save energy, it disconnects regularly. So I’m looking for a cheap alternative which has the same functionality as you would with a garage door… ( this wouldn’t have to connect / pair anymore like it previously would with the Bluetooth shutter) I have a RPI Zero W. Any recommendations on what CHEAP receiver / transmitter to get?
Would someone kindly be able to help me with micropython?
what do you need help with?
So I installed Micropython on my esp8266 and it seems to work fine. I can see the Micropython wifi running well, and I was able to connect with the default password, but I can't connect to serial at all. I erased data, and the serial gets detected. However, when I flash the.bin file, Micropython seems to be running fine because the wifi there is Micropython, and I can't get serial connection until I get the esp on boot mode.
The serial doesn't get detected at all
Let me show you my screen
Hey do not be concerned I see I need to connnect usb through the gpio pins
Hey, does a time.sleep() really help avoid hogging cpu load? I have an RX loop on an RPi that needs to read messages as fast as possible during some stages, and was wondering if adding in a variable sleep factor would be worth considering instead of just removing the sleep completely
I think the rx reads using pyserial in some manner
How do you transfer files to ESP32 devices when the micropython functions deepsleep/lightsleep block any connection?
it has to be woken up first
Hello my amigos, i have an arduino uno and a DHT11 module, im trying to use pyfirmata with it but im not sure how since i know with arduinos ide, you have to use a library for it to work, anyone know how to do it?
yo, lol i wanna buy a raspberry pi Zero..... Where do i buy it? Its out of stock everywhere.
even the official sellers of raspberry bi don't have it.
Is this an appropriate channel to discuss the M5Stack and coding with Python on UIFlow?
Is it perhaps possible to to reprogram this microprocessor of this broken china cell phone though this pins.
This is a china fitness watch
I found the data sheet of this http://wiki.phyplusinc.com/doc/DataSheet/PHY6202_BLE_SoC_Datasheet_v1.4.pdf
I it possible to proggram this with another microprocessor like esp32
or arduino r3
BORGize it!!!!
yes you can use any of those as a make shit serial programmer, if you know the programming protocol
sounds pretty appropriate
What about arm?
you'll have to keep radar out for restocks.... all new raspberry pi stock of stuff gets sold out almost as it comes up
How can one board a preproggramed baord
hello dose anyone know a microcontroller that can run python with a microphone and speaker and wifi
not at the same time, or it would be called a SOC (system on chip)
@spiral sandal okay which one do you recommend me to buy
if you look for cheap soc wih no special gpu caps then look for lichee-pi or raspi zero
there are models with amps and microphone and wifi just search with caution
ok
don't go for lowest prices they could be amputated ( at least for lichee pi D1 they have audio/wifi caps on docks )
but are you sure you want to handle all that at once with (micro/circuit)python ? it could be simpler to use CPython on a fullly equiped dev board
i already finished the code
it is working
can you help me
i will explain everything
raspi zero isnt cheap
glad you found out that yourself
i'm biased toward allwinner soc so i try not to impose my views
ok
LicheePi is going to be impossible to find in egypt
you don't have aliexpress or a broker ? maybe make a collective with other people and get a qty
ESP32 family chips have I2S (digital audio) and analog input/output, and wifi, and exist in modules with plenty of ram for a mcu. There are definitely full boards out there with audio in and out
I wish I could point to an Adafruit board for the example but the boards they put mics on don't have wifi it seems, it's not hard to add an external mic though (well harder than you would on a PC)
If I want a Python script that controls LEDs to run forever on a pi, what’s the best way of running the file?
thanks
i think i will buy it
Might not be the right place to ask, but does anyone know of a place where I can find a dockerfile which replicates the jetpack 4.6.1 release? ie, has OpenCV 4.1.1, python 3.6.9, etc.
Specifically looking to make a docker container on an nvidia Jetson Nano with GPU accelerated stuff. I've looked around for a very long time now but I'm starting to think I'll need to make some sort of amalgam dockerfile for what we need and I'm not sure what the steps I need to take in a dockerfile are to install opencv with gpu acceleration and gstreamer support (Please @elder knot if you respond btw :))
@elder knot I can help u with making the dockerfile and making the container image
Run the Python script from inside /etc/rc.local and have some kind of infinite loop in your script.
Will that still work if it takes input from a text file that changes every few minutes?
Can u explain a bit more
Basically Im gonna have a text file that represents the total server load that updates ever 5ish minutes and the Python program is gonna do some things with leds based on that number
Wasn’t sure if I needed to turn the Python program into a background process or something similar to let the text file update
And also I don’t know the method of how the text file gets changed, my sys admin said he would take care of that as long as I write the program
ok so means your program will read some numeric value from that text file and update the LEDs. right??
Correct
Have not made the program yet, was gonna use the built-in file reading functions, open() and read()
Ok
Some reason it was taking a long time to install libraries yesterday and my workday ended before it was done installing
The actual program should be pretty simple, my sys admin asked me to control an led strip which is kinda of like a “progress bar” style thing which represents the total server load to be able to get a quick visual of the load without having to view anything
Yeah I was just wondering the logistics of actually “deploying” the program
The program will start at boot time, if u run it from /etc/rc.local as a background process and your text file should also be present during boot time
otherwise u need to run the script after boot
Would probably be better to run on boot
is your file present at boot time?
would there be any point in the next Raspberry Pi Pico being slightly more tolerant to running actual operating systems on it? Like Fuzix but with real memory management
and > 15 processes
I'm just asking because I'm curious; no agenda here.
and say > 256k of RAM or however little amount it currently has
- for the same price as current Picos
anyone here tried compile micropython for m5stack?
successful build but firmware is not working, i get no prompt on serial
I apologize for not responding yesterday! I'm a student and I ended up having a professor help me out. We figured it out, thank you for your offer though :)
✅✅
Hey. Were you able to solve this problem?
Did anyone attempt to use pypi package to control lego mindstorms?
thats a good idea , any one here have a LEGO mindstorm to test
Is there a way to communicate to a arduino using iPhone?
Hi Thelilbigbag, you can put a HTTP server on the Arduino that you can then open via Safari
soundmodem too
Ok but is there a way where I can upload code to a arduino from a iPhone?