Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Development / Re: Wiimote Extension Library on: March 20, 2009, 01:22:42 pm
Can your libraries be used to read data from the Wiimote as well, say the button pushes and the accelerometer readings?
2  Forum 2005-2010 (read only) / Interfacing / Talking to Wiimote via Bluetooth (without PC) on: March 17, 2009, 10:18:11 am
I'm thinking about a project where I use an Arduino board with a Bluetooth module (like this: http://www.sparkfun.com/commerce/product_info.php?products_id=8474) and have it function as a receiver in an RC car.  The controller would be a Wiimote or Wiimote + Classic Controller.  I have seen others use this path: Wiimote -> laptop via Bluetooth -> Arduino via USB -> Futaba controller -> RC receiver.  I would like instead to have the Arduino w/Bluetooth be in the RC car and eliminate the laptop in the loop.  Can the Wiimote connect directly to a Bluetooth module or does it have to go through a software app on a PC first?
3  Forum 2005-2010 (read only) / Interfacing / Interfacing to LASCAR EM32-4-LED 4-Digit Display on: March 16, 2009, 02:07:07 pm
I needed to interface with this device for a work project: http://www.lascarelectronics.com/temperaturedatalogger.php?datalogger=110

Figuring out the serial control was pretty straightforward but tedious, so I am providing the following snippets of code for anyone else who may need to interface to this or similar serial-controlled LED 8-segment (7 for digit plus decimal) displays in the future.  Simple modifications to the code can allow for variations in how the data is displayed. Hopefully this will help others who want to use their Arduino with these displays.  The comments in the code explain how it works, but if there are any questions, let me know!



Code:
//variable definitions

int clockPin = 10;    //digital pin for the serial clock
int dataPin = 11;    //digital pin for the serial data
int resetPin = 12;    //digital pin for serial reset

int integerArray[4];  //integer array that will eventually be displayed on LED display

byte passArray[5];    //byte arrays for the shiftOut() function
byte failArray[5];
byte displayLEDArray[5];

byte LED0 = 0x7E;    //bytes corresponding to the number shapes on the LED display
byte LED0Dot = 0x7F;
byte LED1 = 0x0C;
byte LED1Dot = 0x0D;
byte LED2 = 0xB6;
byte LED2Dot = 0xB7;
byte LED3 = 0x9E;
byte LED3Dot = 0x9F;
byte LED4 = 0xCC;
byte LED4Dot = 0xCD;
byte LED5 = 0xDA;
byte LED5Dot = 0xDB;
byte LED6 = 0xFA;
byte LED6Dot = 0xFB;
byte LED7 = 0x0E;
byte LED7Dot = 0x0F;
byte LED8 = 0xFE;
byte LED8Dot = 0xFF;
byte LED9 = 0xCE;
byte LED9Dot = 0xCF;
byte LEDOff = 0x00;

void setup() {

  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(resetPin, OUTPUT);  
  
  //byte arrays loaded for PASS/FAIL LED display
        
  passArray[0] = 0x10; //00010000 - leading zeros, start bit, and external LED bits (off)
  passArray[1] = 0xDA; //11011010 - S (no decimal)
  passArray[2] = 0xDA; //11011010 - S (no decimal)
  passArray[3] = 0xEE; //11101110 - A (no decimal)
  passArray[4] = 0xE6; //11100110 - P (no decimal)
        
  failArray[0] = 0x10; //00010000 - leading zeros, start bit, and external LED bits (off)
  failArray[1] = 0x70; //01110000 - L (no decimal)
  failArray[2] = 0x60; //01100000 - I (no decimal)
  failArray[3] = 0xEE; //11101110 - A (no decimal)
  failArray[4] = 0xE2; //11100010 - F (no decimal)
  
  displayLEDArray[0] = 0x10;  //first byte in the LED display array loaded with leading zeros and start bit
}

void loop() {

  digitalWrite(resetPin, LOW);
  for (int j = 0; j < 5; j++) {
    shiftOut(dataPin, clockPin, MSBFIRST, failArray[j]);  //displays FAIL on LED display
  }

  digitalWrite(resetPin, LOW);
  for (int j = 0; j < 5; j++) {
    shiftOut(dataPin, clockPin, MSBFIRST, failArray[j]);  //displays PASS on LED display
  }

  fillArray();  //fills displayLEDArray with correct bytes to draw characters on LED display corresponding to integers in integerArray

  digitalWrite(resetPin, LOW);
  for (int j = 0; j < 5; j++) {
    shiftOut(dataPin, clockPin, MSBFIRST, displayLEDArray[j]);  //displays other numerical data as stored in the byte array with fillArray()
  }
}

void fillArray() {
  for (int i = 1; i < 5; i++) {  //we start at 1 because the first byte was already loaded up with leading zeros and the start bit
          switch (integerArray[(i-1)]) {
            case 0:  
              if (i == 2) {  //the third byte contains the decimal point, giving you 2 significant digits - change to i == 3 for 3 significant digits
                displayLEDArray[i] = LED0Dot;  
              } else
              if (i == 4) {
                displayLEDArray[i] = LEDOff;  //leading zero is not displayed (e.g. 03.14 displayed as 3.14, while 0.31 will display as is)
              }
              else
                displayLEDArray[i] = LED0;
              break;
            case 1:
              if (i == 2) {
                displayLEDArray[i] = LED1Dot;
              }
              else
                displayLEDArray[i] = LED1;
              break;
            case 2:
              if (i == 2) {
                displayLEDArray[i] = LED2Dot;
              }
              else
                displayLEDArray[i] = LED2;
              break;
            case 3:
              if (i == 2) {
                displayLEDArray[i] = LED3Dot;
              }
              else
                displayLEDArray[i] = LED3;
              break;
            case 4:
              if (i == 2) {
                displayLEDArray[i] = LED4Dot;
              }
              else
                displayLEDArray[i] = LED4;
              break;
            case 5:
              if (i == 2) {
                displayLEDArray[i] = LED5Dot;
              }
              else
                displayLEDArray[i] = LED5;
              break;
            case 6:
              if (i == 2) {
                displayLEDArray[i] = LED6Dot;
              }
              else
                displayLEDArray[i] = LED6;
              break;
            case 7:
              if (i == 2) {
                displayLEDArray[i] = LED7Dot;
              }
              else
                displayLEDArray[i] = LED7;
              break;
            case 8:
              if (i == 2) {
                displayLEDArray[i] = LED8Dot;
              }
              else
                displayLEDArray[i] = LED8;
              break;
            case 9:
              if (i == 2) {
                displayLEDArray[i] = LED9Dot;
              }
              else
                displayLEDArray[i] = LED9;
              break;
          }
     }
}
4  Forum 2005-2010 (read only) / Exhibition / Re: LumiNet (based on attiny84) on: July 19, 2010, 11:06:29 am
I see that there is now an attiny84 core for the arduino-0018 IDE.  Has anyone created a core for the attinyx5 devices (specifically the attiny85)?  That comes in a nice 8-pin DIP/SOIC and would be great for simple designs.  Thanks!
5  Forum 2005-2010 (read only) / Exhibition / Re: LumiNet (based on attiny84) on: May 20, 2009, 10:20:36 am
Thanks for the IDE - looks like it will be helpful to many of us.  For just general purpose ATTinyx5 work, which LumiNet board should be selected as a target?  I have a board with an ATTiny85V on it and I wanted to test out the IDE but I wasn't sure what device to target.

Thanks again!
6  Forum 2005-2010 (read only) / Exhibition / Re: LumiNet (based on attiny84) on: May 15, 2009, 10:18:20 am
Any news about the ATTiny Arduino IDE release?  I can't wait to test it out - I already have an Arduino-like board assembled for it and I'd love to program it up using your IDE.  Thanks!  smiley
7  Forum 2005-2010 (read only) / Exhibition / Re: LumiNet (based on attiny84) on: March 20, 2009, 01:15:12 pm
Hi, I am very interested in your project using the ATTiny microcontrollers and the Arduino IDE.  I have a project that might take advantage of the ATTiny85/84.  I know your LumiNet project uses the ATTiny84 - would the same bootloader/IDE mods work with the 85 as well?  They are very similar in their features, except the 85 can come in an 8-pin package (PDIP/SOIC, which is easier to prototype with).  I haven't really decided which would be better for my application, and both come in the same MLF package, but I know I need the low voltage and low power consumption of the Tiny's (need to operate on one lithium cell down to <2.0V). My initial application would use just one chip, but I have other ideas for using small, cheap, low-power devices embedded in a wireless sensor network.  Hopefully your work make it into the official release.  These Tiny's are really perfect for battery-operated projects and being able to use the Arduino/Wiring language would make development that much quicker. Thanks and I look forward to your release of the bootloader and IDE!
8  Forum 2005-2010 (read only) / Exhibition / Re: NRL Satellite (ARDUINO IN SAPCE!) on: March 16, 2009, 02:05:20 pm
Project looks really cool! I used to work with NRL and know several employees there - which code is sponsoring this?  Again, congrats and let us know when she flies!
Pages: [1]