Premier Pas avec le Raspberry Pi: Difference between revisions

From air
Jump to navigation Jump to search
Line 84: Line 84:
* Via GPIO : http://blog.oscarliang.net/raspberry-pi-and-arduino-connected-serial-gpio/
* Via GPIO : http://blog.oscarliang.net/raspberry-pi-and-arduino-connected-serial-gpio/


Read http://playground.arduino.cc/Interfacing/Python


Install pySerial
Install pySerial
Line 100: Line 101:
import serial
import serial
ser = serial.Serial('/dev/ttyACM0', 9600)
ser = serial.Serial('/dev/ttyACM0', 9600)
while 1 :
while True :
ser.readline()
print ser.readline()
</pre>
</pre>

More with [[Firmata]] : https://github.com/lupeke/python-firmata/


===Lego Mindstorm NXT===
===Lego Mindstorm NXT===

Revision as of 20:28, 13 August 2013

Prérequis

  • carte SD 8 GB (classe 10 si possible)
  • clavier Logitech K400
  • cable HDMI
  • écran ou TV avec entrée HDMI (normal)

Réseau

Branchez votre RPI avec un cable Ethernet à votre box (Ethernet) ou un routeur. Par défaut, l'adresse IP est donné par le serveur DHCP de la box.

Si vous n'en avez pas, il est possible d'activer le partage internet sur votre Mac :

Préférences Système > Partage > Partage Internet : cochez Thunderbolt Ethernet puis Partage Internet

Pour connaitre l'adresse du RPI, une de ces 3 commandes;

ping 192.168.1.255
ping 192.168.255.255
arp -a

Démarrage

Suivez les instructions : http://elinux.org/RPi_Beginners

Loggez vous : pi puis raspberry

Changez le mot de passe de pi

Lancez le desktop

startx

Configuration complémentaire

Voir http://www.tropfacile.net/doku.php/raspberry-pi/comment-passer-votre-raspberry-en-francais

sudo raspi-config


Sélectionnez SSD pour l'activer (enable) afin de pouvoir vous passer d'un écran pour vous logger (à distance) sur le RPI.

Configuration du clavier Logitech K400

sudo nano /etc/default/keyboard
    #Keyboard configuration files

    #Consult the keyboard(5) manual page.

    XKBMODEL="logicd"
    XXBLAYOUT="fr"
    XKBVARIANT=" "
    XKBOPTIONS=" "

    BACKSPACE="guess"

Equipements supplémentaires

Listez les équipements USB branchés au moyen de la commande lsusb

lsusb

Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 004: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 005: ID 2341:0043 Arduino SA Uno R3 (CDC ACM)

Dongle Wifi USB

Webcam Logitech

Arduino Uno

Read http://playground.arduino.cc/Interfacing/Python

Install pySerial

sudo apt-get install python-serial

Check the Arduino tty port

ls /dev/tty*


Run the following python script

import serial
ser = serial.Serial('/dev/ttyACM0', 9600)
while True :
    print ser.readline()

More with Firmata : https://github.com/lupeke/python-firmata/

Lego Mindstorm NXT

Quelques idées