Outils pour utilisateurs

Outils du site


issue87:arduino

Several months ago, I took the plunge and decided to risk buying a couple of cheap Arduino Nanos from China. These are still Arduinos – but just not from the original designers. They were listed on eBay for £3 each so I went for three of them. Apparently keeping it under £15 means no import tax, which turned out to be true. The Nanos arrived complete with a dinky USB cable. I hooked it up to my laptop and tried running the blinking LED sketch. Error. Now I was worried. I feared the worst in that either they were damaged or just plain didn’t work. Then I realised that I hadn’t changed the Arduino model in the IDE menu. Oops! With the LED sketch uploaded and running I now knew the Nanos were working. Great!

Il y a plusieurs mois, j'ai sauté le pas et j'ai pris le risque d'acheter quelques Arduino Nanos bon marché en Chine. Ce sont bien des Arduino, mais ne viennent pas des fabricants originaux. Ils étaient proposés sur eBay à 3 £ l'un (3,8 €) et j'en ai pris trois. Apparemment, des commandes de moins de 15 £ évite toute taxe, ce qui s'est avéré vrai.

Les Nanos sont arrivés complets avec un câble USB miniature. Je l'ai connecté à mon portable et j'ai essayé de lancer la séquence de la LED clignotante. Erreur. Du coup, j'étais inquiet. Je craignais le pire car soit je les avais endommagés, soit ils ne fonctionnaient tout simplement pas. Ensuite, je me suis rendu compte que je n'avais pas changé le modèle d'Arduino dans le menu IDE. Oups !

Après avoir téléchargé la séquence de la LED et l'avoir lancé, j'ai su enfin que les Nanos fonctionnaient. Super !

The plan for one Nano was to realise my dream of having indicators on my bicycle. First I dug out the old sketch for the spaceship panel which covered holding down a button to flash an LED. I removed the unnecessary code and comments and now had a Nano with one flashing LED when a button was held down. I now duplicated the button, LED and wiring and voila! Bicycle indicators! Note that the Nano slots directly into the breadboard unlike the Uno which sits separately. I did think about modifying the code so that pressing once would turn the LED on then pressing again to turn it off, but that might mean me cycling along with indicators flashing not realising I’ve left them on and, ultimately, draining the battery (which I’ll hook up later). Obviously, this would now leave the breadboard and be physically soldered onto veroboard with wires running the length of the bicycle. But that’s for me to figure out later. My (butchered) code is at: http://pastebin.com/urJPfr9C

Pour un Nano, mon plan était de réaliser mon rêve d'avoir des clignotants sur mon vélo. D'abord j'ai ressorti la vieille séquence d'un panneau de vaisseau de l'espace qui cachait un bouton dont l'appui faisait clignoter une LED. J'ai enlevé le code inutile et les commentaires, ce qui fait que j'avais un Nano avec une LED clignotante quand je maintenais le bouton enfoncé. Puis j'ai dupliqué le bouton, la LED et le câblage et « voilà » ! [Ndt : en français dans le texte.] Des clignotants de vélo !

Notez que le Nano est inséré directement sur la platine contrairement au Uno qui est à part.

Je pensais modifier le code pour qu'une pression rende la LED clignotante puis qu'une autre l'éteigne, mais ça me faisait penser que je pourrais pédaler tout le temps avec mes clignotants enclenchés sans m'en rendre compte pour, finalement, mettre la batterie à plat (que je connecterai plus tard).

Bien entendu, tout cela devrait quitter la platine pour être soudé physiquement sur du Veroboard avec des fils sur toute la longueur du vélo. Mais c'est à moi de régler ça plus tard.

Mon code (bâclé) est sur : http://pastebin.com/urJPfr9C

issue87/arduino.txt · Dernière modification : 2015/01/07 16:09 de auntiee