Это видео недоступно.
Сожалеем об этом.
Raspberry Pi Pico W LESSON 29: Simple Client Server Project to Control RGB LED
HTML-код
- Опубликовано: 17 авг 2024
- This is the OLED display we will be using in future lessons. Please go ahead and order it so you will have it for next week's lesson:
amzn.to/3nq8l4Z
You guys can help me out over at Patreon, and that will help me keep my gear updated, and help me keep this quality content coming:
/ paulmcwhorter
In this class we will be using the Sunfounder Raspberry Pi Pico W Keppler Kit. It will make things a lot easier if we are working on identical hardware. the link below is to amazon, and is for the identical hardware I will be using in this entire class.
amzn.to/3ubMRs1
In this introductory video, I will show you how to set up a simple client server relationship over wifi for the Raspberry Pi Pico W. The Pico W acts as a server, and your pc will act at the client. We will communicate wirelessly over wifi between your pc and pico pi using a UDP socket. We will control the color of an RGB LED on the Raspberry Pi Pico W from commands sent from the client program on the PC. Communication is completely wireless, and the pico is powered by a rechargeable LiPo battery. Enjoy!
[Disclosure of Material Connection: I am a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com. ]
#raspberrypipicoW
#oled
#wifi
Thank you, you're a great teacher.
This was a very satisfying and rewarding lesson! Thank you!
Glad you enjoyed it!
Was having a similar issue as Paul by having to unplug the USB cable from the Pico for a reset. To remedy this going forward I placed a N.O. Push Button on my breadboard wired from Pin # 30 to Ground for a Reset . Works great and takes away the chance of damaging the USB connector. Hope this helps someone ... Thanks Paul for all you do !
We learn so much more doing the projects with you even when there are errors.
Paul, you make learning through these lessons so much fun! Thanks for all your hard work!
Thanks Paul. My troubleshooting skills have greatly improved.
Wow, what sophisticated WIFI project. The sky is the limit. 🥳 Thank you.
this was yet ANOTHER GREAT LESSON!
Thanks Paul! The program worked as advertised. I would like to fold but the culprit was the breadboard falling apart and the sockets not holding the connection. Anyway, I was able to reroute the connections to make it work! I even when to the other end of the house and it worked in the most excellent way! No wires, no tape, none needed...
: ) Looking forward to the next lesson!!!!!!!!!!!
Thank you. really interesting and useful. Love the way you fault find the code on the fly.
I like your videos.❤
Paul is a superman, if you think about it.😮
Thanks!
Thanks! Really appreciate the support.
Yes my G. U r a bad man. Respect. U hit it right out of the park.
Thanks for the great lesson!
Good day. The instruction is wonderful. I'm having a bit of a conumdrum. The server program as taught in lesson 28 is working fine. However a portion of the sketch that is fine there is not happy in the lesson 29 program with the oled and RGB.
I have imported the following libraries which are different from the previous lesson. (from what I read on line, that could be a problem sometimes because the program only reads the most recent imports so some people import library modules within functions_ from what I read). These are the libraries in the second server program (with OLED)
from time import sleep
import network
import machine
from machine import Pin,I2C
from ssd1306 import SSD1306_I2C
import socket
The following line is not a problem in the server program lesson 28 but is in this lesson 29 server program.Both identical in every way.
wifi =network.WLAN(network.Sta_IF)
The resultant error is:
MPY: soft reboot
[61]
Traceback (most recent call last):
File "", line 69, in
AttributeError: 'module' object has no attribute 'Sta_IF'
I've tried importing the entire machine module with the attendant changes in the code but no success. Any thoughts.
It should be all caps: wifi = network.WLAN(network.STA_IF)
Thanks Paul.
Thank you paul
Thanks Paul!
I couldn't download ssd1306 library via tools/manage Packages etc so I copied ssd1306 from git hub but get error message when I try to use OLED.
The LED pin part works OK.
I think Paul has wrong time for today currently showing 8:30AM.
I did a read of temperature and humidity. It worked with the read done in the loop with the blocking recvfrom() call but an attempt to use _thread to allow the read loop to run on a separate thread and set the global temperature and humidity that would be returned in the separate server loop failed. The thread would start and take measurements but did not appear to allow the main loop to run. I did not attempt to use select() to get around blocking on recvfrom()
Here's my solution to lesson 28: ruclips.net/video/xUUd3Khn1ug/видео.html
I AM LEGEND! Thanks for this most-excellent lesson. My solution to the homework was very similar to Paul's. I think the Pico W is vastly superior to the Arduinos in many ways, especially in bang-for-the -buck. The wireless Wifi capability makes it a great candidate for remote control projects. I would like to learn to control projects from my smartphone. Since Bluetooth communication is now available with the Pico W, I would like to learn how to use it.
LEGEND!
Just a tidy-up, Paul! In yellow on 1306, you have the server's IP as 192.168.88.10. When in actual fact, the IP address is 192.168.88.100. The problem is that there are not enough pixels to fit the whole IP address. But no problem, as you correctly recorded the server IP as 192.168.88.100 because you defined it straight from ServerIP=wifiInfo[0]. So, No real problem! It's just a bit untidy!!!
This is a beautiful lesson!!! Can we somehow package it up so we can drop it into our future coding efforts?
Yes, must be careful with the tiny screen.
Wow.. Great lesson Paul ... I like the idea of using the "secrets" file for network info. Not sure if I'm implimenting it correctly. If anybody can pass on some info it would be greatly appreciated.. Thanks everyone !!
Secrets file is easy. Just set your varialbes, like:
SSID='myWifi'
PASSWORD='buffy1212'
save program as secrets.py
Then in your main program:
import secrets
print(secrets.SSID)
print(secrets.PASSWORD)
Play around with that and see if it makes sense
Thanks Paul for your follow up...Will get it going...👍@@paulmcwhorter
Hello paul, can you please advise a physics Msc student on what to do with raspberry pi for his thesis?
could replace the color checks (12 lines) with just 3 lines
ledred.value( 1 if cmdDecoded.lower() == "red" else 0 )
ledgreen.value( 1 if cmdDecoded.lower() == "green" else 0 )
ledblue.value( 1 if cmdDecoded.lower() == "blue" else 0 )
I am legend!
LEGEND!
How about add GPS and google earth in Python to this list of Lessons
Here's an update to my initial Lesson 28 homework assignment, this time using TKinter to make a GUI front-end for the client program that generates commands to control the RGB LED on the Pico W-hosted server program: ruclips.net/video/NMp9hco1ZoQ/видео.html
Excellent!
Hello Paul,
It's a great lesson again!
I've a little Problem with the display in row 1 from the server IP-Address. My IP-Address (IP:192.168.200.54) is cut to (IP:192.168.200.5), because there isn't enough space for all Characters in one row. The font uses 8 pixels per character, that means 17 characters each 8 pixel are 132 pixel in a row. But the display only has 128 pixel in the row.
Is it possible to change the fontsize only for row 1?
Any other hints?
Thanks
Helmut
I am getting this error on line 19 = AttributeError: 'tuple' object has no attribute 'value'
import socket
import time
import network
#import secrets
import machine
from machine import Pin,I2C
from ssd1306 import SSD1306_I2C
#redLEDPin=16
#greenLEDPin=17
#blueLEDPin=18
#redLED=(redLEDPin,Pin.OUT)
#greenLED=(greenLEDPin,Pin.OUT)
#blueLED=(blueLEDPin,Pin.OUT)
#redLED.value(1)
I know i have the commands remarked out...i was moving on to the other sections of the experiment...
I am running Micropython on a Pico W.
Any help??
I got it figured out
What was the problem?@@user-ky7fs9td3k
Sorry to trouble you, for some reason all now working