In this video lesson we show how you can control a PIO State Machine on the Raspberry Pi Pico W inside of a micropython class. We demonstrate with the practical example of controlling servos with a servo Class which we create. The objective is to ‘hide’ all the complex code in the class, allowing less adept users to interact with the servo with simple python commands. For your convenience the code developed in this video is included below. Enjoy!
In this video lesson we show how you can work with more than one state machine at the same time in microPython on the Raspberry Pi Pico W. We show this in the context or controlling multiple servos. We show different ways to utilize multiple state machines. For your convenience, we provide the code developed in the video below. Enjoy!
In this video lesson we show how you can use the Raspberry Pi Pico PIO State Machine to sweep a servo through its full range of motion. The video will take you through things step-by-step. For your convenience the code developed in the video is included below. Enjoy!
In this video tutorial we show you how you can use a Raspberry Pi Pico PIO Statemachine to control the position of a servo. For your convenience, the code from this lesson is presented below. Enjoy!
A challenge in many Arduino projects is that it can be difficult to get I2C components working properly. Many times the libraries and demonstration code indicate a certain I2C address for the component, but the Arduino is unable to find the component at that Address. This can be a challenge, because often times we might not have the exact same version of the component that is assumed in the libraries and code. A perfect example of this are the SSD1306 OLED displays. Many of the components look identical, but they can have different I2C addresses. In order to overcome this challenge, the following code allows you to scan your I2C Bus, and list the address of all the components found. Simply attach the component as instructed in the component documentation. Then run the following code. It will list the address of the I2C components it finds. Then you can edit the sample code to use the proper address. Enjoy!
Arduino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <Wire.h>
#define myWire Wire
intnumDevices;
byteerror,address;
voidsetup(){
myWire.begin();
Serial.begin(9600);
Serial.println("Find I2C Devices: ");
}
voidloop(){
Serial.println("Scanning...");
numDevices=0;
for(address=1;address<127;address=address+1){
myWire.beginTransmission(address);
error=myWire.endTransmission();
if(error==0){
Serial.print("I2C device found at address 0x");
if(address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
numDevices=numDevices+1;
}elseif(error==4){
Serial.print("Unknown error at address 0x");
if(address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if(numDevices==0)
Serial.println("No I2C devices found");
delay(5000);
}
Making The World a Better Place One High Tech Project at a Time. Enjoy!
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok