Archive
ESP8266 WiFi module
Link for add board manager
http://arduino.esp8266.com/stable/package_esp8266com_index.json
Erase the esp
esptool.py erase_flash
Code to flash AT firmware to ESP8266 (ESP8266_AT_Bin_V1.5.1)
esptool.py --baud 115200 --port /dev/tty.wchusbserial1420 write_flash -fm dio -ff 40m -fs detect 0x00000 boot_v1.7.bin 0x01000 user1.1024.new.2.bin 0xfc000 esp_init_data_default.bin 0x7e000 blank.bin 0xfe000 blank.bin
L293D, H Bridge Arduino
L293D is a DC motor controller.
Below Arduino code to use it.
unsigned char table[128] = {0};
int motor1_A=6;
int motor1_B=5;
int motor1_Speed=3;
void setup()
{
pinMode(motor1_A,OUTPUT);
pinMode(motor1_B,OUTPUT);
}
void loop()
{
// motor1
for (int i=0; i<256; i+=1){
digitalWrite(motor1_A,HIGH); // A = HIGH and B = LOW means the motor will turn right
digitalWrite(motor1_B,LOW);
analogWrite(motor1_Speed,i); // speed counts from 0 to 255
delay(20);
}
for (int i=255; i>0; i-=1){
digitalWrite(motor1_A,HIGH); // A = HIGH and B = LOW means the motor will turn right
digitalWrite(motor1_B,LOW);
analogWrite(motor1_Speed,i); // speed counts from 0 to 255
delay(20);
}
}
Crontab on Linux
To launch a program at reboot.
contab -e
Add following line to crontab file:
@reboot sudo python /home/pi/hw-home.py /home/pi/hw-home.txt
Arduino and Python
If you want to read Arduino serial from Python.
Install pySerial:
pip intall pyserial
the code:
import serial
...
print('# Arduino Reader - hackweb')
print('entering loop...')
ardu = serial.Serial('COM3', 115200)
time.sleep(2)
while True:
print(ardu.readline())
Open, Agassi
Maybe my favourite one. A great story in the deep of a great champion.
This book tells about youth, life, decisions. It’s the soul of a man vs the mysteries of life.