Recueil de Code divers

Cette page est devenu obsolète suite à la découverte de ce super outil web : Pearltrees Chercher “patsour”

ça permet de stocker tous les liens des sites que l'on a trouvé, avec des fichiers, des notes et sans doute d'autre options sympa.

En vrac

Tout plein d'essais, même sur des shields pas connus :

Le très connu hackster :

- Site 1:

Différent projets avec l'arduino, contient une librairies pour le code kaku RF433Mhz
Traduction du billet :,38075.0.html&prev=/search%3Fq%3Drf433%2Belro%2Barduino%2B1.0.5%26client%3Dbrowser-ubuntu%26channel%3Dfe%26biw%3D1680%26bih%3D851

Téléchargement des librairies :

Fichier readme :

RemoteSwitch library v2.0.0 (20100130) for Arduino 0017
Made by Randy Simons
This library provides an easy class for Arduino, to send and receive signals
used by some common 433MHz remote control switches
See RemoteSwitch.h for details!
License: "Free BSD license". See ./RemoteSwitch/license.txt
Installation of library:
-Make sure Arduino is closed
-Copy the directory RemoteSwitch to the Arduino library directory (usually
Default installation sender & demo:
-Connect tha data-in-pin of a 433MHz transmitter to digital pin 11. See photo.
 (Note: your hardware may have a different pin configuration!)
-Start Arduino, and open the example: File -> Examples -> RemoteSwitch ->
-Alter addresses/devices to reflect your own setup. Otherwise nothing will
-Compile, upload and run!
Default installation receiver & demo
-Connect the data-out-pin of a 433MHz receiver to digital pin 2. See photo.
 (Note: your hardware may have a different pin configuration!)
-Start Arduino, and open the example: File -> Examples -> RemoteSwitch ->
-Compile, upload and run
-Open serial monitor in Arduino (115200 baud)
-Press buttons on a 433MHz-remote, and watch the serial monitor

- Site 2

Fichier Readme :

PulseSensorAmped_Arduino_1dot2 is modified code for PulseSensor
SAA1064 library for I2C controlling 4x 7-segment common-anode LEDs
The MIDI translator takes input from MIDI device attached to RX and outputs MIDI attached to TX
pulseMonitorPCD8544 takes input from PulseSensor and displays on Nokia 5110 LCD

- Site 3

Git :

Fichier Readme :
Che Cosa?

Cosa is an object-oriented platform for Arduino that supports an event-driven programming paradigm with simple finite state machines. It contains a rich set of classes to support rapid prototyping of Internet-of-Things devices. Cosa supports the following AVR/ATmega/ATtiny internal hardware modules; all pin modes, Digital, and Analog Pins, External and Pin Change Interrupts, Analog Comparator, PWM, Watchdog, Timer0 (RTC), Timer1 (Servo), UART, USI, SPI, TWI and EEPROM.

Though object-oriented with optional operator overloading syntax Cosa is between 2-10X faster than Arduino with regard to digital pin functions. This comes with a small price-tag; memory, 4 bytes per digital pin and 12 bytes per analog pin. Cosa analog pin objects holds the latest sample and allows an event handler. See the benchmarks in the examples directory for further details.

Cosa contains several data streaming formats for message passing and data streaming. Google Protocol Buffers are supported together with a data streaming format (Ciao) for encoding of C/C++ language data types such as strings, integer and floating pointer numbers into a binary format. It may be used for a number of applications; tracing, remote procedure calls, data exchange between Arduino devices, etc. The format allows user data types to be defined and values exchanged without additional encoding. The stream header itself is a pre-defined serializable data type. Ciao is used to define an Arduino monitoring and control language (Cosa fai) which has much in common with Firmata. See CIAO.txt for more details and the example code (examples/Ciao).

The primary programming paradigm is object-oriented and state-machine/event driven with proto-threads. There is a large number of device drivers available for SPI, TWI/I2C and 1-Wire. A strict directory structure is used to organize the Cosa/driver source code. Sub-directories are used for each driver type. This allows a foundation for scaling and configuration.

Cosa uses the Arduino IDE and build system. Cosa classes are included with prefix, e.g. “Cosa/FileName.hh”. It is possible to use both Arduino and Cosa functions together, though in some cases the Cosa objects may become inconsistent.

To improve debugging and testing there is trace/syslog style support. The IOStream class allows output to both serial communication (UART/VWIO) and small TFT displays (such as the ST7735, ST7564, HD44780 and PCD8544). The Cosa LCD class extends IOStream::Device with additional common LCD functions. The drawing Canvas class supports basic drawing operation and scripting to reduce program memory footprint. The Canvas class also supports drawing of icons and multiple fonts (GLCD and UTFT).

The popular VirtualWire library has been refactored to the object-oriented style of Cosa (VWI) and extended with three additional codecs; Manchester, 4B5B and Bitstuffing. This allows basic ultra cheap wireless nodes with RF315/433 receiver and transmitter. For more advanced wireless connections there is also a driver for the Nordic Semiconductor NRF24L01+ chip, which allows low-power wireless communication of up to 2 Mbps in the 2.4GHz band, and the TI CC1101 Low-Power Sub-1 GHz RF Transceiver. These are interchangable through an abstract Wireless interface.

The primary goal of this project is to provide an efficient programming platform for rapid prototyping of “Internet-of-things”-devices and sensor networks. Unfortunately Cosa is not a beginners entry level programming platform, though following some of the design patterns in Cosa will help beginners build more complex small scale embedded systems with richer concurrency and low power consumption.

The projects main principle of evolution is iterative with many rewrites and refactoring. With that said this phase of the project will require users to align with the interface changes. When interfaces become stable the project will switch to a normal release style.

Please follow the development of this project on blogspot and on the Arduino forum.


The Cosa zip file is an Arduino core package. Download and unzip in your Sketchbook hardware folder. 
Create the folder if missing. 
Restart the Arduino IDE and Cosa will show up as a number of boards and example sketches.

For ATtiny a patch is needed for Arduino Windows version to allow linking programs larger than 4K; See Do not forget to program the ATtiny device with the bootloader, i.e., set the fuse bits, before using the device for the first time.

The Application Programmers Interface (API) documentation is available online and compressed for download. The documentation contains a full hyperlinked description of all functions in Cosa together with UML graphs of the class hierarchy, include dependencies, and much more.

The provided documentation is generated with doxygen and may also be generated for users source code if the Cosa documentation style is adapted. See the Doxyfile for configuration of doxygen.


  DS18B20 Programmable Resolution 1-Wire Digital Thermometer.
  AT24CXX Serial EEPROM.
  DS1307 Realtime clock with RAM.
  PCF8591 2-Wire 8-bit A/D and D/A converter.
  ADXL345 Digital Accelerometer.
  nRF24L01 Single Chip 2.4GHz Transceiver.
  DHT11 Humidity & Temperature Sensor.
  HC-SR04/US-020 Ultrasonic range module.
  ST7735, 262K Color Single-Chip TFT Controller.
  PCD8544 48x84 pixels matrix LCD controller/driver.
  TSOP4838 IR Receiver Modules for Remote Control Systems.
  Virtual Wire (VWI) on RF315/433 modules.
  HMC5883L 3-Axis Digital Compass IC.
  NEXA/HomeEasy Wireless Remote command transmitter/receiver for RF433.
  ST7565, 65x132 Dot Matrix LCD Controller/Driver.
  Touch capacitive sensor, debounced button and keypad.
  Dials with Rotary Encoder.
  HD44780 (aka 1602, 2004) LCD Controller/Driver.
  DS3231, Extremely Accurate I2C-Integrated RTC/TCXO/Crystal.
  PCF8574/PCF8574A Remote 8-bit I/O expander for I2C-bus with interrupt.
  BMP085 Digital Pressure Sensor.
  TI CC1101 Low-Power Sub-1 GHz RF Transceiver.
  L3G4200D Digital Gryposcope.
  MPU6050 Motion Processing Unit; Digital thermometer, accelerometer and gyroscope.
  DS1302 Tickle-Charge Timekeeping Chip.
  SD card, SPI driver.
  RS485 support; master-slave protocol.
  Slave device support for SPI, TWI and OWI.

  Quantum Leaps,,
  Arduino ATtiny,
  Arduino Low Power,
  Virtual Wire,


  "Cosa"; noun thing, matter; pronoun; what?, what!.
  "Che cosa"; pronoun; what.
  "Ciao"; interjection hello!, goodbye!.
  "Cosa fai"; what do you do?
  "Rete"; network


ATtinyX4/X5/X61, Atmega328P, Atmega1284P, Atmega2560 and Atmega32u4 based Arduino boards (Uno, Mini, Mini Pro, Micro, Nano, Leonardo, LilyPad, LilyPad USB, Mighty, Mega, etc) are supported. ATmega32U4 internal USB hardware (e.g. CDC) is not currently supported. News

2013-01 Arduino Mega 2560 initial port. UTFT font support added. Proto-threads implemented. Draw/fill round rectangle added to Canvas. 2013-02 Adding doxygen generated documentation ( GLCD font support added. IR remote receiver initial example. Adding input/output operators to IOStream, Pins and SPI. More detailed benchmarks and comparison with Arduino added. IOStream driver for PCD8544 48×84 pixels matrix LCD controller with support for fonts and icons. TSOP4838 IR Receiver Modules support (LG remote example). Improving PCD8544 driver with OffScreen canvas. UART receiver, Device::getchar(), implemented. Adding generic circlic buffer for IOStream::Device. Adding support for ATtinyX5. Simple ATtiny monitor included. Adding support for RC Servo. Adding support for ATmega1284P/Mighty boards. Refactoring and porting VirtualWire to Cosa. 2013-03 Virtual Wire Interface (VWI) for ATtiny. VWI IOStream Device to allow streaming of output over Virtual Wire. Introducing Manchester Phase Encoder (MPE) based on VWI. Introducing class for Power Management and Sleep Modes. Refactoring VWI to allow easy update of codecs; VirtualWire, Manchester and Fixed Bitstuffing. Additional codex; Block Coding, B4B5. New VWI example sketches with retransmission; simple client/server example. Introducing an interface for interrupt handlers, and support for pin change interrupts. New directory structure for handling boards. Moving documentation and references to dropbox. Reducing size of download from github. 2013-04 Adding support for HMC5883L 3-axis digital compass. Adding abstraction of EEPROM with default handling of internal EEPROM. Refactoring AT24CXX driver for new EEPROM interface. Implemented 1-wire parasite power mode. Improved DS18B20 1-wire driver and demo sketches with VWI integration. Added support for battery voltage monitoring. New extended mode in VWI with node address, sub-net address matching, message sequence numbering and type handling. NEXA Wireless Remote command receiver (RF433). Added a reliable message passing protocol to the Virtual Wire Interface (VWI). The new class VWI::Transceiver supports message acknowledgement and auto-retransmission. Full support for message parsing. 2013-05 Improving ATtiny support. Adding driver for DHT22. NEXA Wireless Remote command transmitter (RF433). Introducing a new template class for handling of keyed sets of event handlers. Added support for LCD ST7565 with natural text scrolling. Making it easy to implement TWI slave devices with TWI::Device. Including support for event driven Rotary Encoder handler. 2013-06 HD44780 (1602) LCD device driver. Adding support for Sockets. Refactoring NRF24L01P device driver to a Socker::Device with support for both connection-less and connection-oriented communication. DS3231 device driver and example sketches. Driver for the PCF8574/PCF8574A Remote 8-bit I/O expander for I2C-bus with interrupt. Support for 20×4 LCD. 2013-07 Introducing an abstract LCD::Device class and refactoring LCD device drivers. Benchmarking and optimizing LCD device drivers. Added an event driven resistor net keypad handler and support for the DFRobot LCD Keypad shield. Boosting LCD performance to 2-6X faster than Arduino library. Added a new LCD menu system. Refactored Cosa directory structure to match the Arduino core file structure. Performance tuning LCD adapters; additional adapters with shift register support (SR3W and SR4W). Adding Vigenere autokey and RC4 cipher. 2013-08 Updating DHT11/22 device driver. Adding a simple touch capacitive sensor. 2013-09 Major refactoring of SPI and TWI device driver support. 2013-10 Device driver for CC1101 and BMP085 introduced. Introducting an abstract Wireless device interface. Refactoring Virtual Wire, CC1101 and NRF24L01P to the new interface. Improving support for low power mode. Adding a Registry for mapping from path (index sequence) to data storage in PROGMEM, EEPROM and SRAM. Mapping may also be to Action object in SRAM. Support for LCD TWI port expander GY-IICLCD. Wireless IOStream class introduced to allow binding of Wireless device driver to IOStream and trace output over Wireless. First draft of RETE; data distribution and network management protocol. Adding support for L3G4200D digital gyroscope. 2013-11 New device driver for MPU6050 Motion Processing Unit; Digital thermometer, accelerometer and gyroscope. Adding support for bitsets and Google Protocol Buffers data encoding/decoding. Character and token scanner to IOStream. Allowing blocking and non-blocking IOStream device mode. Added support for ATtinyX61 and a variant of Base64 for encoding of binary data. 2013-12 DS1302 RTC and SD card support. Simple FAT16 library using SD. Support for RS485 with master-slave protocol. ATmega32u4 support added with USB/CDC.

- Site 4

Control lights with an Arduino remotely with 433Mhz

I wanted to use Arduino's for a domotica project. The main purpose is to control the lights in my livingroom, using a web-interface. This way I can switch on and off my lights with my mobile phone, iPad, etc. even when I am not home (over the internet)! Because making elektrical connections with Arduino's and the outlet power supply went wrong one time earlier (blew all the fuses!), I wanted to use secure standard components for the high-power part. So, I bought these:

To be able to send and receive the remote's signals, I used the RemoteSwitch library as RF-library, check

For the webserver on the Arduino, I used the Webduino Library.
To store the learned codes, and be able to remember them (even after a reset of the Arduino),
I store them in the EEPROM. An easy way to store stuff in the EEPROM, is by using the EEPROMAnything code.

My code examples:
Simplified source using GET requests and without 7-segment LED display:
Source code I am using in the video:

projets/arduino.txt · Dernière modification : 2019/09/14 08:37 de chef
CC Attribution-Share Alike 4.0 International Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0