Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Looking for ways to upload bitmaps to SD via Teensy 3 and over bluetooth

  1. #1
    Member neep's Avatar
    Join Date
    Jan 2013
    Location
    Amsterdam, NL
    Posts
    82

    Looking for ways to upload bitmaps to SD via Teensy 3 and over bluetooth

    So I have an LED staff built that can do POV pretty okay. What I want now is to be able to upload bitmaps for the staff to display. I already got SD memory working, using PJRC's adapter. I also have basic bluetooth communications working, so that I can turn on and off the status LED on the Teensy for example, using a serial terminal program on my laptop. I can read and write from SD, but I still have no idea how get files on there over bluetooth.

    The thing is, I don't have an Android phone, so I'm looking for something I can use from my macbook. I also don't have much in the way of Java programming skills, so maybe someone can help out there, or knows an app that can already get me on the way. Some simple method to drive anything over bluetooth from OSX that doesn't involve me having to type into the terminal app would be very helpful right now.

    This is the staff so far:


  2. #2
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    354
    One option is a USB MicroSD adapter... I use this one: Newegg - IOGEAR MicroSD Adapter

  3. #3
    Member neep's Avatar
    Join Date
    Jan 2013
    Location
    Amsterdam, NL
    Posts
    82
    I just got some files onto a card using my Nokia phone, no problem. What I want however is to be able to do this without having to break open the staff once again to swap out the card every time I want new images on there ;-) I was looking at Xmodem just now, found some code for it in Google, but seems rather complicated to get that working, and can't find any examples with that. I think I should just go for a cheap enough Android phone. I've been postponing getting a smartphone for years as I work with computers all day already and like to get that break from them... but I guess I have to cave in now.

  4. #4
    Member neep's Avatar
    Join Date
    Jan 2013
    Location
    Amsterdam, NL
    Posts
    82
    Right, so I have a bitmap on the card, and I can read it with the "dumpfile" example code. So this is what it looks like in ASCII:

    [CODE]Initializing SD card...card initialized.
    opening file BITMAPS/FOXFIRE.BMP
    reading data from file: BMv

  5. #5
    Member neep's Avatar
    Join Date
    Jan 2013
    Location
    Amsterdam, NL
    Posts
    82
    Right, so I have a bitmap on the card, and I can read it with the "dumpfile" example code. So this is what it looks like in ASCII:

    Code:
    Initializing SD card...card initialized.
    opening file BITMAPS/FOXFIRE.BMP
    reading data from file:
    (and then a whole bunch of garbage that I can't get into the post here for some reason, the forum parser just breaks off my post in the middle)

    So now onto how do I translate this raw bitmap data into RGB info for my LEDs.

    What I got so far is just single color characters:

    Code:
    boolean charA[] = {
      0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
      0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
      0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0,
      0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0,
      0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
      0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
      0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0,
      0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0,
    };
    The bitmap images are 8 pixels high, that's how many I have on each side of my staff. So now I have to translate that into 0 - 255 values for each of the above pixels, like above, but with bytes instead of booleans. I feel like I am reinventing the wheel here, but sometimes that's fun, so I'll just keep going on this path.

  6. #6
    Member
    Join Date
    Feb 2013
    Location
    Kansas City, Misery
    Posts
    43
    Not sure if this will help you or not. It is some code I found in a diy led hoop project at http://philihp.com/blog/2011/diy-led-hula-hoop/

    All his code is at: https://github.com/philihp/Jubilee

    He has his logo bit mapped in a file called carrot.h:

    Code:
    uint32_t carrot[158] = {
    0x00000000,
    0x00000000,
    0x00000000,
    0x00000000,
    0x00000000,
    
    ................................................................... etc, etc, on and on.
    
    };
    The routine he uses to display the bitmap is in his jubilee.pde file down in the handlestrip() function, it is case 6:

    Code:
     case 6: //carrot POV
          j = tick % 158;
          d = carrot[j];
                                   //green                     //orange
          c = (j < 30)?GetColor((color+2)%MAX_COLORS):GetColor((color+3)%MAX_COLORS);
          for(i=0;i<32;i++) {
            //adding 32 to the index makes it appear on the side opposite the controller
            if(d & 0x00000001) {
              strip.setPixelColor(i+32, c);
            }
            else {
              strip.setPixelColor(i+32, strip.Color(0,0,0));
            }
            d >>= 1;
          }
          break;
    Not sure what LEDs you are using, he is using a set of LPD8806s with 32 LEDs per meter I believe so the handling is probably different if you are using WS's.

    Anyway, I have not played with the code yet at all so I know nothing more about it.

    Hope it helps.
    Last edited by Russ; 02-11-2013 at 05:19 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •