PAGE MARK
S.NO DATE NAME OF THE EXPERIMENT SIGNATURE
NO
EX NO: 01
8051 Assembly Language program using Keil simulator
PROGRAM:
ORG 0000H
CLR C
MOV A, #20H
ADD A, #21H
MOV R0, A
END
EXP NO:02
Test data transfer between registers and memory
DATE
PROGRAM:
TYPE-I:
ORG 0000H
CLR C
MOV R0, #55H
MOV R1, #6FH
MOV A, R0
MOV 30H, A
MOV A, R1
MOV 31H, A
END
PROGRAM:
TYPE-II:
ORG 0000H
CLR C
MOV R0, #30H
MOV R1, #40H
MOV R7, #06H
BACK: MOV A, @R0
MOV @R1, A
INC R0
INC R1
DJNZ R7, BACK
END
EXP NO: 03
ALU operations
DATE
PROGRAM:
ORG 0000H
CLR C
//ADDITION
MOV A, #20H
ADD A, #21H
MOV 41H, A
//SUBTRACTION
MOV A, #20H
SUBB A, #18H
MOV 42H, A
//MULTIPLICATION
MOV A, #03H
MOV B, #04H
MUL AB
MOV 43H, A
//DIVISION
MOV A, #95H
MOV B, #10H
DIV AB
MOV 44H, A
MOV 45H, B
//AND
MOV A, #25H
MOV B, #12H
ANL A, B
MOV 46H, A
//OR
MOV A, #25H
MOV B, #15H
ORL A, B
MOV 47H, A
//XOR
MOV A, #45H
MOV B, #67H
XRL A, B
MOV 48H, A
//NOT
MOV A, #45H
CPL A
MOV 49H, A
END
:
EXP NO:04
WRITE BASIC AND ARITHMETIC PROGRAMS
DATE
USING EMBEDDED C
PROGRAM:
#include<REG51.h>
int i,j;
sbit LED = P2^0;
void main()
{
while(1)
{
LED = 0;
for(j=0;j<10000;j++);
LED = 1;
for(j=0;j<10000;j++);
}
}
PROGRAM:
#include<REG51.H>
unsigned char a, b;
void main()
{
a=0x10;
b=0x04;
P0=a-b;
P1=a+b;
P2=a*b;
P3=a/b;
while(1);
}
OUTPUT:
Port P0=
Port P1=
Port P2=
Port P3=
EX NO:05
INTRODUCTION TO THE ARDUINO PLATFORM
DATE
AND PROGRAMMING
PROGRAM:
const int led1 = 6, led = 7, led = 8;int delayvalue = 1000;
void setup()
{
pinMode(led, 1); // HIGH = 1 and INPUT = 0pinMode(led 2, OUTPUT);
pinMode(led 3, OUTPUT);
}
void loop()
{
digitalWrite(led1, 1); // HIGH = 1 means 5 voltsdigitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);delay(delayvalue);
digitalWrite(6, 0); // LOW = 0 means 0 voltdigitalWrite(7, LOW);
digitalWrite(8, LOW);delay(delayvalue); delayvalue == 50;
if(delayvalue == 0)
delayvalue = 1000;
}
OUTPUT:
EX NO: 6a INTERFACING ARDUINO TO ZIGBEE MODULE
PROGRAM:
TRANSMITTER SIDE:
#include<SoftwareSerial.h>
SoftwareSerial mySerial(2,3); //rx,tx
void setup() {
mySerial.begin(9600);
Serial.begin(9600);
}
void loop() {
mySerial.write('A');
Serial.println('A');
delay(100);
mySerial.write('B');
Serial.println('B');
delay(100);
}
RECEIVER SIDE:
#include<SoftwareSerial.h>
SoftwareSerial mySerial(2,3); //rx,tx
void setup() {
mySerial.begin(9600);
Serial.begin(9600);
pinMode(4, OUTPUT);
}
void loop() {
if(mySerial.available()>0)
{
char data=mySerial.read();
Serial.println(data);
if(data=='A')
digitalWrite(4,HIGH);
else if(data=='B')
digitalWrite(4,LOW);
}
}
OUTPUT:
EX NO: 6b
INTERFACING ARDUINO TO GSM MODULE
PROGRAM:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(9, 10);
void setup()
{
mySerial.begin(9600); // Setting the baud rate of GSM Module
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
delay(100);
}
void loop()
{
if (Serial.available() > 0)
switch (Serial.read())
{
case 's':
mySerial.println("AT+CMGF=1"); // Sets the GSM Module in Text Mode
delay(1000);
mySerial.println("AT+CMGS=\"" + 919616288208 "\"\r"); // Replace x with mobile number
delay(1000);
mySerial.println("Technolab creation"); // The SMS text you want to send
delay(100);
mySerial.println((char)26); // ASCII code of CTRL+Z for saying the end of sms to the module
delay(1000);
break;
case 'r':
mySerial.println("AT+CNMI=2,2,0,0,0"); // AT Command to receive a live SMS
delay(1000);
break;
}
if (mySerial.available() > 0)
Serial.write(mySerial.read());
}
OUTPUT:
EX NO: 6c
INTERFACING ARDUINO TO BLUETOOTH MODULE
DATE
PROGRAM:
#include<SoftwareSerial.h>
SoftwareSerial mySerial(2,3);
//rx,tx void setup() {
mySerial.begin(9600);
Serial.begin(9600);
pinMode(4, OUTPUT);
}
void loop() {
if(mySerial.available()>0)
{
char data=mySerial.read();
Serial.println(data);
if(data=='1')
{ digitalWrite(4,HIGH);
Serial.println("LED ON");
}
else if(data=='2'){
digitalWrite(4,LOW);
Serial.println("LED OFF");
}
}
}
OUTPUT:
EX NO: 7 INTRODUCTION TO THE RASPBERRY PI PLATFORM
AND PYTHON PROGRAMMING
PROGRAM:
#!/usr/bin/env python
import RPi.GPIO as GPIO # RPi.GPIO can be referred as GPIO from now
import time
ledPin = 22 # pin22def setup():def setup():
GPIO.setmode(GPIO.BOARD) # GPIO Numbering of Pins
GPIO.setup(ledPin, GPIO.OUT) # Set ledPin as output
GPIO.output(ledPin, GPIO.LOW) # Set ledPin to LOW to turn Off the LED
def loop():
while True:
print 'LED on'
GPIO.output(ledPin, GPIO.HIGH) # LED On
time.sleep(1.0) # wait 1 sec
print 'LED off'
GPIO.output(ledPin, GPIO.LOW) # LED Off
time.sleep(1.0) # wait 1 sec
def endprogram():
GPIO.output(ledPin, GPIO.LOW)
GPIO.cleanup()
if _name_ == '_main_':
try:
loop()
except KeyboardInterrupt:
endprogram()
OUTPUT:
EXP NO:
INTRODUCTION TO PYTHON PROGRAMMING
DATE
Getting Started with Thonny MicroPython (Python) IDE:
If you want to program your ESP32 and ESP8266 with MicroPython firmware, it’s very handy to
use an IDE. you’ll have your first LED blinking using MicroPython and Thonny IDE.
What is MicroPython?
MicroPython is a Python 3 programming language re-implementation targeted for microcontrollers
and embedded systems. MicroPython is very similar to regular Python. Apart from a few
exceptions, the language features of Python are also available in MicroPython. The most significant
difference between Python and MicroPython is that MicroPython was designed to work under
constrained conditions.
Because of that, MicroPython does not come with the entire pack of standard libraries. It only
includes a small subset of the Python standard libraries, but it includes modules to easily control
and interact with the GPIOs, use Wi-Fi, and other communication protocols.
Thonny IDE:
Thonny is an open-source IDE which is used to write and upload MicroPython programs to
different development boards such as Raspberry Pi Pico, ESP32, and ESP8266. It is extremely
interactive and easy to learn IDE as much as it is known as the beginner-friendly IDE for new
programmers. With the help of Thonny, it becomes very easy to code in Micropython as it has a
built-in debugger that helps to find any error in the program by debugging the script line by line.
You can realize the popularity of Thonny IDE from this that it comes pre-installed in Raspian OS
which is an operating system for a Raspberry Pi. It is available to install on r Windows, Linux, and
Mac OS.
A) Installing Thonny IDE – Windows PC
Thonny IDE comes installed by default on Raspbian OS that is used with the Raspberry Pi board.
To install Thonny on your Windows PC, follow the next instructions:
1. Go to https://thonny.org
2. Download the version for Windows and wait a few seconds while it downloads.
3. Run the .exe file.
4. Follow the installation wizard to complete the installation process. You just need to click “Next”.
5. After completing the installation, open Thonny IDE. A window as shown in the following figure
should open.
CONNECTIONS:
Raspberry Pi Pico Raspberry Pi Pico
Pin Development Board
GP16 LED
PROGRAM
LED:
from machine import Pin
import time
LED = Pin(16, Pin.OUT)
while True:
LED.value(1)
time.sleep(1)
LED.value(0)
time.sleep(1)
CONNECTIONS:
Raspberry Pi Pico Raspberry Pi Pico
Pin Development Board
(RGB)
GP16 R
GP17 G
GP18 B
GND COM
RGB:
from machine import Pin
from time import sleep_ms,sleep
r=Pin(16,Pin.OUT)
y=Pin(17,Pin.OUT)
g=Pin(18,Pin.OUT)
while True:
r.value(1)
sleep_ms(1000)
r.value(0)
sleep_ms(1000)
y.value(1)
sleep(1)
y.value(0)
sleep(1)
g.value(1)
sleep(1)
g.value(0)
sleep(1)
CONNECTIONS:
Raspberry Pi Pico Raspberry Pi Pico
Pin Development Board
GP16 LED
GP15 SW1
SWITCH CONTROLLED LED:
from machine import Pin
from time import sleep
led=Pin(16,Pin.OUT)
sw=Pin(15,Pin.IN)
while True:
bt=sw.value()
if bt== True:
print("LED ON")
led.value(1)
sleep(2)
led.value (0)
sleep(2)
led.value (1)
sleep(2)
led.value(0)
sleep(2)
else:
print("LED OFF")
sleep(0.5)
RESULT:
EXP NO:
INTERFACING SENSORS WITH RASPBERRY PI
DATE
AIM:
To interface the IR sensor and Ultrasonic sensor with Raspberry Pico.
HARDWARE & SOFTWARE TOOLS REQUIRED:
S.No Hardware & Software Requirements Quantity
1 Thonny IDE 1
2 Raspberry Pi Pico Development Board 1
3 Jumper Wires few
4 Micro USB Cable 1
5 IR Sensor 1
6 Ultrasonic sensor 1
PROCEDURE
CONNECTIONS:
Raspberry Pi Pico Raspberry Pi Pico
IR Sensor Module
Pin Development Board
GP16 BUZZER -
GP15 - OUT
- 5V VCC
- GND GND
PROGRAM:
IR Sensor:
from machine import Pin
from time import sleep
buzzer=Pin(16,Pin.OUT)
ir=Pin(15,Pin.IN)
while True:
ir_value=ir.value()
if ir_value== True:
print("Buzzer OFF")
buzzer.value(0)
else:
print("Buzzer ON")
buzzer.value (1)
sleep(0.5)
CONNECTIONS:
Raspberry Pi Pico Raspberry Pi Pico
Ultrasonic Sensor Module
Pin Development Board
GP16 BUZZER -
GP15 - ECHO
GP14 - TRIG
- 5V VCC
- GND GND
ULTRASONIC SENSOR:
from machine import Pin, PWM
import utime
trigger = Pin(14, Pin.OUT)
echo = Pin(15, Pin.IN)
buzzer = Pin(16, Pin.OUT)
def measure_distance():
trigger.low()
utime.sleep_us(2)
trigger.high()
utime.sleep_us(5)
trigger.low()
while echo.value() == 0:
signaloff = utime.ticks_us()
while echo.value() == 1:
signalon = utime.ticks_us()
timepassed = signalon - signaloff
distance = (timepassed * 0.0343) / 2
return distance
while True:
dist = measure_distance()
print(f"Distance : {dist} cm")
if dist <= 10:
buzzer.value(1)
utime.sleep(0.01)
else:
buzzer.value(0)
utime.sleep(0.01)
utime.sleep(0.5)
RESULT:
EXP NO: COMMUNICATE BETWEEN ARDUINO AND
DATE RASPBERRY PI
AIM:
To write and execute the program to Communicate between Arduino and Raspberry PI
using any wireless medium (Bluetooth)
HARDWARE & SOFTWARE TOOLS REQUIRED:
S.No Hardware & Software Requirements Quantity
1 Thonny IDE 1
2 Raspberry Pi Pico Development Board 1
3 Arduino Uno Development Board 1
4 Jumper Wires few
5 Micro USB Cable 1
6 Bluetooth Module 2
PROCEDURE
CONNECTIONS:
Arduino UNO Pin Arduino Development Board Bluetooth Module
2 - Tx
3 - Rx
- GND GND
- 5V 5V
PROGRAM:
MASTER
ARDUINO:
#include<SoftwareSerial.h>
SoftwareSerial mySerial(2,3); //rx,tx
void setup() {
mySerial.begin(9600);
}
void loop() {
mySerial.write('A');
delay(1000);
mySerial.write('B');
delay(1000);
}
CONNECTIONS:
Raspberry Pi Pico Raspberry Pi Pico
Bluetooth Module
Pin Development Board
GP16 LED -
VCC - +5V
GND - GND
GP1 - Tx
GP0 - Rx
CS3691 EMBEDDED SYSTEMS AND IOT
SLAVE
RASPBERRY PI PICO
from machine import Pin, UART
uart = UART(0, 9600)
led = Pin(16, Pin.OUT)
while True:
if uart.any() > 0:
data = uart.read()
print(data)
if "A" in data:
led.value(1)
print('LED on \n')
uart.write('LED on \n')
elif "B" in data:
led.value(0)
print('LED off \n')
uart.write('LED off \n')
41 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
RESULT:
42 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
EXP NO:
CLOUD PLATFORM TO LOG THE DATA
DATE
AIM:
To set up a cloud platform to log the data from IoT devices.
HARDWARE & SOFTWARE TOOLS REQUIRED:
S.No. Software Requirements Quantity
1 Blynk Platform 1
CLOUD PLATFORM-BLYNK:
Blynk is a smart platform that allows users to create their Internet of Things applications without
the need for coding or electronics knowledge. It is based on the idea of physical programming &
provides a platform to create and control devices where users can connect physical devices to the
Internet and control them using a mobile app.
Setting up Blynk 2.0 Application
To control the LED using Blynk and Raspberry Pi Pico W, you need to create a Blynk project and
set up a dashboard in the mobile or web application. Here’s how you can set up the dashboard:
Step 1: Visit blynk.cloud and create a Blynk account on the Blynk website. Or you can simply
sign in using the registered Email ID.
Step 2: Click on +New Template.
43 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
Step 3: Give any name to the Template such as Raspberry Pi Pico W. Select ‘Hardware Type’ as
Other and ‘Connection Type’ as WiFi.
So a template will be created now.
44 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
Step 4: Now we need to add a ‘New Device’ now.
Select a New Device from ‘Template’.
45 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
Select the device from a template that you created earlier and also give any name to the device. Click
on Create.
A new device will be created. You will find the Blynk Authentication Token Here. Copy it as it is
necessary for the code.
46 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
Step 5: Now go to the dashboard and select ‘Web Dashboard’.
From the widget box drag a switch and place it on the dashboard screen.
47 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
Step 6:
On the switch board click on Settings and here you need to set up the Switch. Give any title to it and
Create Datastream as Virtual Pin.
Configure the switch settings as per the image below and click on create.
48 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
Configure the final steps again.
With this Blynk dashboard set up, you can now proceed to program the Raspberry Pi Pico W board
to control the LED.
Step 7:
49 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
To control the LED with a mobile App or Mobile Dashboard, you also need to setup the Mobile
Phone Dashboard. The process is similarly explained above.
Install the Blynk app on your smartphone The Blynk app is available for iOS and Android.
Download and install the app on your smartphone. then need to set up both the Mobile App and the
Mobile Dashboard in order to control the LED with a mobile device. The process is explained
above.
1. Open Google Play Store App on an android phone
2. Open Blynk.App
3. Log In to your account (using the same email and password)
4. Switch to Developer Mode
5. Find the “Raspberry Pi Pico Pico W” template we created on the web and tap on it
6. Tap on the “Raspberry Pi Pico Pico W” template (this template automatically comes because we
created it on our dashboard).
7. tap on plus icon on the left-right side of the window
8. Add one button Switch
9. Now We Successfully Created an android template
10. it will work similarly to a web dashboard template
50 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
51 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
RESULT:
52 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
EXP NO: Log Data using Raspberry PI and upload it to the cloud
DATE platform
AIM:
To write and execute the program Log Data using Raspberry PI and upload it to the cloud
platform
HARDWARE & SOFTWARE TOOLS REQUIRED:
S.No Hardware & Software Requirements Quantity
1 Thonny IDE 1
2 Raspberry Pi Pico Development Board few
3 Jumper Wires 1
4 Micro USB Cable 1
PROCEDURE
53 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
CONNECTIONS:
Raspberry Pi Pico Raspberry Pi Pico
LCD Module
Pin Development Board
- 5V VCC
- GND GND
GP0 - SDA
GP1 - SCL
54 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
PROGRAM:
from machine import Pin, I2C, ADC
from utime import sleep_ms
from pico_i2c_lcd import I2cLcd
import time
import network
import BlynkLib
adc = machine.ADC(4)
i2c=I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
I2C_ADDR=i2c.scan()[0]
lcd=I2cLcd(i2c,I2C_ADDR,2,16)
wlan = network.WLAN()
wlan.active(True)
wlan.connect("Wifi_Username","Wifi_Password")
BLYNK_AUTH = 'Your_Token'
# connect the network
wait = 10
while wait > 0:
if wlan.status() < 0 or wlan.status() >= 3:
break
wait -= 1
print('waiting for connection...')
time.sleep(1)
# Handle connection error
if wlan.status() != 3:
raise RuntimeError('network connection failed')
else:
print('connected')
ip=wlan.ifconfig()[0]
print('IP: ', ip)
"Connection to Blynk"
# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)
lcd.clear()
55 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
while True:
ADC_voltage = adc.read_u16() * (3.3 / (65536))
temperature_celcius = 27 - (ADC_voltage - 0.706)/0.001721
temp_fahrenheit=32+(1.8*temperature_celcius)
print("Temperature in C: {}".format(temperature_celcius))
print("Temperature in F: {}".format(temp_fahrenheit))
lcd.move_to(0,0)
lcd.putstr("Temp:")
lcd.putstr(str(round(temperature_celcius,2)))
lcd.putstr("C ")
lcd.move_to(0,1)
lcd.putstr("Temp:")
lcd.putstr(str(round(temp_fahrenheit,2)))
lcd.putstr("F")
time.sleep(5)
blynk.virtual_write(3, temperature_celcius)
blynk.virtual_write(4, temp_fahrenheit)
blynk.log_event(temperature_celcius)
blynk.run()
time.sleep(5)
RESULT:
56 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
EXP NO:
Design an IOT-based system
DATE
AIM:
To design a Smart Home Automation IOT-based system
HARDWARE & SOFTWARE TOOLS REQUIRED:
S.No Hardware & Software Requirements Quantity
1 Thonny IDE 1
2 Raspberry Pi Pico Development Board few
3 Jumper Wires 1
4 Micro USB Cable 1
5 LED or Relay 1
PROCEDURE
57 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
CONNECTIONS:
Raspberry Pi Pico Raspberry Pi Pico
Pin Development Board
GP16 LED 1
58 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
PROGRAM:
import time
import network
import BlynkLib
from machine import Pin
led=Pin(16, Pin.OUT)
wlan = network.WLAN()
wlan.active(True)
wlan.connect("Wifi_Username","Wifi_Password")
BLYNK_AUTH = 'Your_Token'
# connect the network
wait = 10
while wait > 0:
if wlan.status() < 0 or wlan.status() >= 3:
break
wait -= 1
print('waiting for connection...')
time.sleep(1)
# Handle connection error
if wlan.status() != 3:
raise RuntimeError('network connection failed')
else:
print('connected')
ip=wlan.ifconfig()[0]
print('IP: ', ip)
"Connection to Blynk"
# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)
# Register virtual pin handler
@blynk.on("V0") #virtual pin V0
def v0_write_handler(value): #read the value
if int(value[0]) == 1:
led.value(1) #turn the led on
else:
59 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
CS3691 EMBEDDED SYSTEMS AND IOT
led.value(0) #turn the led off
while True:
blynk.run()
RESULT:
60 | Prepared by Mr. S. BALABAKSER, ASP/ECE
www.stannescet.ac.in
EXTRA PROGRAMS
LCD DISPLAY:
from machine import Pin, I2C
from time import sleep
from pico_i2c_lcd import I2cLcd
i2c=I2C(0, sda=Pin(0), scl=Pin(1), freq=400000)
I2C_ADDR=i2c.scan()[0]
lcd=I2cLcd(i2c,I2C_ADDR,2,16)
while True:
lcd.move_to(3,0)
lcd.putstr("Ediylabs")
sleep(5)
lcd.clear()
Raspberry Pi Pico 16X2 LCD Display
Development Board
5V VCC
GND GND
GP0 SDA
GP1 SCL
DHT 11 Sensor:
from machine import Pin, I2C
import utime as time
from dht import DHT11, InvalidChecksum
while True:
time.sleep(1)
pin = Pin(16, Pin.OUT, Pin.PULL_DOWN)
sensor = DHT11(pin)
t = (sensor.temperature)
h = (sensor.humidity)
print("Temperature: {}".format(sensor.temperature))
print("Humidity: {}".format(sensor.humidity))
time.sleep(2)
Connection
Raspberry Pi Pico DHT11
Development Board
5V VCC
GND GND
GP16 DATA
SERVO MOTOR:
from time import sleep
from machine import Pin, PWM
pwm = PWM(Pin(1))
pwm.freq(50)
while True:
for position in range(1000,9000,50):
pwm.duty_u16(position)
sleep(0.01)
for position in range(9000,1000,-50):
pwm.duty_u16(position)
sleep(0.01)
Connection
Raspberry Pi Pico SERVOMOTOR
Development Board
GND BROWM
5V RED
GP1 ORANGE
STEPPER MOTOR:
from machine import Pin
from time import sleep
IN1 = Pin(12,Pin.OUT)
IN2 = Pin(13,Pin.OUT)
IN3 = Pin(14,Pin.OUT)
IN4 = Pin(15,Pin.OUT)
pins = [IN1, IN2, IN3, IN4]
sequence = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]
while True:
for step in sequence:
for i in range(len(pins)):
pins[i].value(step[i])
sleep(0.001)
Connection
Raspberry Pi Pico STEPPER MOTOR
Development Board
5V + (5V)
GND - (GND)
GP12 IN1
GP13 IN2
GP14 IN3
GP15 IN4