A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

First Arduino tests

After turning on a few LEDs, making them glow at different brightness, it was time for something a little different. I hooked up a Nintendo Wii nunchuck controller I can now turn on LEDs with the push buttons, use the joystick or hand movements to alter the brightness of another pair or LEDs depending on which axis the controller or joystick is moved.
So far the test code is based on code at horizon casino resortjugar tragaperras lineajuego instantaneo portal internetcasinos internacionalesjugar casinoganancia casino pagina internetpremios dinero onlinecasino virtual paginas webbaccara webafiliados casinossistema ruletadownload slotsdownloads juegoswww casinocasinos onlinejuegos gratis de la ruletajuegos interactivos internetruleta suerte onlinejugar al instante paginas webcasinos portales webvideo slotsganar premio linearoulette gratisapuesta pagina internetjuego seguro lineafree casino onlinejuego seguro portales internetjugar seguro lineajuego casino internetpremio dinero paginas webpromociones casino portalesganancias casinos onlineruleta americana internetcasinos virtuales paginas webganar dinero portales internetcasinos descargas internetpromociones casino paginas webonline casinosbest bonus casinogamble onlinecasinos internacionales portalesdescarga gratis ruleta,ruleta gratis,jugar gratis a la ruletajuegos casino descarga gratisjuego pagina webganar dinero paginas webruleta americana portales webganar premio portales webblackjack en linea gratisjuego de la ruleta,juego de la ruleta de la fortuna on line,juego ruletaplay craps The c button toggles a LED on and off at each press, the Z button, if held down alters the brightness with the built in accelerometers and when released the joystick is used as a control. What else can be done, well, if a couple of servos were hooked up, you could control their movements or even mirror your hand movements in the X and Y planes.

Sample code:

#include <wire .h>
#include "nunchuck_funcs.h"

int loop_cnt=0;

byte zbut,cbut;
byte ctoggle;
byte released;
byte zSate;
int ledPin = 13;
int ledCPin = 3;
int ledZPin = 4;
int xPin = 6;
int yPin = 9;
int joy_x_axis = 127;
int joy_y_axis = 123;
int accel_x_axis;
int accel_y_axis;

void setup()
  pinMode(ledCPin, OUTPUT);
  pinMode(ledZPin, OUTPUT);

  analogWrite(xPin, joy_x_axis );
  analogWrite(yPin, joy_y_axis );    
  digitalWrite(ledCPin, ctoggle);
  digitalWrite(ledZPin, LOW );

  nunchuck_init(); // send the initilization handshake


void loop()

  if( loop_cnt > 100 ) { // every 100 msecs get new data
    loop_cnt = 0;


    zbut = nunchuck_zbutton();
    cbut = nunchuck_cbutton(); 

    if( cbut ) {
      if( released ) { 
          ctoggle = !ctoggle;
          digitalWrite(ledCPin, ctoggle);
          released = false;
    } else {
      released = true;

    // if z button pressed then movement is by accelerometers
    // if z button is released then joystick used
    if( zbut ) {
      digitalWrite(ledZPin, HIGH);
      accel_x_axis  = nunchuck_accelx(); // ranges from approx 70 - 182
      accel_y_axis  = nunchuck_accely(); // ranges from approx 65 - 173
      analogWrite(xPin, constrain((accel_x_axis - 70) * 2.2, 0, 255) );
      analogWrite(yPin, constrain((accel_y_axis-65)*2.2,0,255));    
    } else {
      digitalWrite(ledZPin, LOW);
      joy_x_axis = constrain((nunchuck_buf[0] - 32) * 1.3,0,255);
      joy_y_axis = constrain((nunchuck_buf[1] - 32) * 1.3,0,255);
      analogWrite(xPin, joy_x_axis);
      analogWrite(yPin, joy_y_axis);


As you can see, fairly simple to write code for these devices using C/C++ structures and syntax.

Pictures to follow.

Bookmark this post: bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Comments are closed.