samedi 19 mars 2016

[Arduino] - Envoyer du code vers l'arduino en ligne de commande

il faut avoir installé le logiciel arduino
sudo apt-get install arduino
Pour envoyer du code sans passer par le logiciel arduino (https://github.com/pobot/ino)
sudo pip install ino
il faut créer un dossier et lancer une commande pour créer l'arborescence type
mkdir test-blink
cd test-blink
ino init -t blink
-t blink: utilise le template blink

les dossiers lib et src sont créés
lib sert a mettre les librairies qui peuvent etre utiles
dans src il faut mettre le code sous forme de fichier .ino (ici le fichier blink.ino s'est créé automatiquement)

Pour compiler, il faut etre dans le dossier test-blink
ino build
une fois le code compiler, pour uploader vers l'arduino voici la commande
ino upload
pour pouvoir lirele port série directement dans la console il faut installer picocom
sudo apt-get install picocom
pour afficher les données du port serie, pour sortir il faut faire Ctrl+A puis Ctrl+X
ino serial 
  source : http://inotool.org/quickstart

dimanche 13 mars 2016

[LINUX] - lancer un script au démarrage

lancer un script au démarrage

ajouter la ligne de commande dans /etc/rc.local

ne pas oublier de donner les droits d'exucution au script
sudo chmod +x script.py

[RASPI] - SDL sur raspberry pi

Pour lancer directement un truc avec pygame il faut installer SDL apparemment
voici comment faire:
(source : https://solarianprogrammer.com/2015/01/22/raspberry-pi-raspbian-getting-started-sdl-2/)

Let’s start by updating our Raspbian installation, feel free to skip this step if your system was recently updated:
sudo apt-get update
sudo apt-get upgrade
Next, we will need to install some libraries that will be used when we build SDL 2:
sudo apt-get install build-essential libfreeimage-dev libopenal-dev libpango1.0-dev libsndfile-dev libudev-dev libasound2-dev libjpeg8-dev libtiff5-dev libwebp-dev automake
SDL 2 can be downloaded from https://www.libsdl.org/download-2.0.php, be sure to select the source code archive, SDL2-2.0.3.tar.gz, or a newer version if available. You can download and extract the archive directly on your Raspberry Pi:
cd ~
wget https://www.libsdl.org/release/SDL2-2.0.3.tar.gz
tar zxvf SDL2-2.0.3.tar.gz
cd SDL2-2.0.3 && mkdir build && cd build
Now, it is time to configure SDL 2:
../configure --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-opengl
or, if you have a Raspberry Pi 2 or 3:
../configure --host=armv7l-raspberry-linux-gnueabihf --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-opengl
The above options will make sure, SDL 2 is built with the OpenGL ES backend and that any SDLapplication will run as a full screen application, the windowed mode under X tends to be more buggy onRaspberry Pi. On the plus side, you will be able to launch your application, or game, directly from the text interface without the overhead of running the X server. If you wish you can start your application fromLXDE (the default window manager for Raspbian) and the application will run full screen.
Assuming, you’ve had no error in the configure phase, you can actually build and install the library:
make -j 4
sudo make install