Show Posts
Pages: 1 ... 389 390 [391] 392 393 ... 517
5851  Community / Bar Sport / Re: Your latest purchase on: May 22, 2011, 12:10:08 pm
doublet,

Where is that store you shopped from? Pretty good price!
5852  Community / Bar Sport / Re: RadioShack is listening so shout out arduino if you want! on: May 21, 2011, 10:41:24 pm
Just being clear, I don't like RadioShack at all. There are apparently many reasons they're not liked by many. I am just thinking that if we shout arduino enough and they might listen. They have many stores over the globe so if they carry arduino then it's going to be a good thing for arduino to see the mass public.
5853  Using Arduino / Programming Questions / Re: How safe this programming practice is? on: May 21, 2011, 04:32:04 pm
Rob,

That'll take me a while to understand what that def means. I'm slow.
5854  Using Arduino / Programming Questions / Re: How safe this programming practice is? on: May 21, 2011, 04:24:48 pm
I didn't know I could add an array to a union before. My test reveals the addresses are the same with all members of the union, so using &c+1 you can get to the next byte but the array is most elegant and shouldn't cause the concern westfw has. I'll do it this way. Thanks again everyone!
5855  Using Arduino / Programming Questions / Re: How safe this programming practice is? on: May 21, 2011, 04:09:33 pm
Thanks westfw, I'll develop a short test code to see what I get from integer and char address compared with long address.

DimKo, the code compiles with your suggestion. I'll do testing too! Thanks.
5856  Community / Bar Sport / RadioShack is listening so shout out arduino if you want! on: May 21, 2011, 04:01:29 pm
Not that they will listen but maybe enough number will make them notice our community and arduino's world-wide spread:

http://blog.radioshack.com/post/2011/05/19/RadioShack-And-The-DIY-Community-You-Talked-Were-Listening.aspx
5857  Community / Exhibition / Gallery / Re: Phi_prompt new release teaser - scrolling list items on: May 21, 2011, 01:38:28 pm
When porting to GLCD you can do inverse text which will be even better.

Great! I'll keep that in mind. Inverted text is a bit hard to read especially normal texts are displayed above and below them.
5858  Using Arduino / Programming Questions / How safe this programming practice is? on: May 21, 2011, 01:36:54 pm
I have a struct where a few members are unions I call four_bytes:

Code:
union four_bytes
{
int i;
long l;
float f;
byte b;
char c;
};

struct phi_prompt_struct
{
  four_bytes step;
}

I do this to save memory. Sometimes I need floating numbers so I can store it in step.f. Other times I need integer I will do step.i.
Now, to further save space, I want to save four bytes of data into step. How safe is it to do this practice? 100% safe, or depends?

Code:
*(&step.c+0)=ch0; // OR step.c=ch0;
*(&step.c+1)=ch1;
*(&step.c+2)=ch2;
*(&step.c+3)=ch3;
5859  Community / Exhibition / Gallery / Re: Phi_prompt new release teaser - scrolling list items on: May 21, 2011, 01:19:01 pm
Here is a new draft for display options, any more input?

Display options:

Bit 0 – Arrow or dot. The first column of the list is a dot if it is not highlighted or an arrow if it is highlighted. This is very useful if you display more than one item on your list.
Bit 1 – index list 1 thru 0. This draws an index (1234567890) at column and row, encoded in step.i as column*100+row. The highlighted item is indicated on the index as a special character, right now as “^”. In later version of the library, I might make this customizable.
Bit 2 – an index current/total, such as 5/12. This is drawn at column and row, encoded in step.i as column*100+row. The highlighted item is the number before the slash while the total list item is after the slash.
Bit 3 – auto scroll. This enables auto scrolling of list items that are too long to fit within given display width. Not enabling this option results in truncated display of first few characters that will fit within given display width.

Bit 4 – flashing cursor. This turns on a flashing black box enabled by the display. The cursor is at the beginning of the list item highlighted.
Bit 5 – Center choice. The highlighted item will always be centered in the display when possible (odd number of rows to display and plenty of items before and after the highlighted item). The list will scroll automatically to center the choice you might make.
Bit 6 – Scrolling bar. This displays a scrolling bar on the right side of the list. It looks like a DOS editor and is only useful for multi-line of list items. Make sure that you don't have anything immediately to the right of the list or run out of screen space.
Bit 7 – Reserved. This is reserved for future options and should not be used.
5860  Community / Exhibition / Gallery / Re: Phi_prompt new release teaser - scrolling list items on: May 21, 2011, 12:25:55 pm
Now the right video is attached  smiley-sweat

Right, if I lose the dot I can save a character, but now I have scrolling items I can be less strict on space saving now. Doing flashing cursor is certainly easy but I don't know if GLCD has corresponding function when porting to GLCD. I'll give it a shot at flashing cursor though.
5861  Topics / Education and Teaching / Arduino workshop featured at American Association of Physics Teachers conference on: May 21, 2011, 12:48:31 am
http://www.aapt.org/Conferences/sm2011/workshops.cfm

Search (ctrl+F) for session W20. I'll be there to gauge interest in using arduino for physics teaching.
5862  Topics / Education and Teaching / Re: Program 4 sending commands to COM port on: May 21, 2011, 12:42:28 am
A very standard solution is a firmata. Just read about it on arduino.cc or try an example in arduino ide under examples->firmata. You will need processing to run the pc side software.
5863  Using Arduino / Displays / Re: Display for Direct Sunlight on: May 21, 2011, 12:38:41 am
I bought a character LCD from adafruit a while back, the one with white text against blue background. It's impossible to read without back light but under direct sun it's quite readable.
5864  Community / Exhibition / Gallery / Remote control light show! on: May 20, 2011, 11:08:06 pm
I used an IR remote control I bought to create a light show, totally customizable via the remote.







Code:
/*
Arduino infrared remote control light show

Programmed by Dr. John Liu
Revision: 05/20/2011
Free software for educational and personal uses.
No warrantee!
Commercial use without authorization is prohibited.
Find details of my libraries and hardware or contact Dr. Liu at
http://liudr.wordpress.com/
All rights reserved.

Dependent library:
Ken Shirriff's IRremote library
*/

#include <IRremote.h>

#define myClockPin 10  // The clock pin for the shift registers
#define myLatchPin 11  // The latch pin for the shift registers
#define myDataPin 12  // The data pin for the shift registers

int RECV_PIN = 9;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  pinMode(myDataPin,OUTPUT);
  pinMode(myClockPin,OUTPUT);
  pinMode(myLatchPin,OUTPUT);
  irrecv.enableIRIn(); // Start the receiver
}

void loop()
{
  static byte last; // Stores last decoded result in case the remote control sends repeat code.
  static byte current; // Stores a number to be displayed on the leds. This has nothing to do with IR remotes.
  static boolean forward_dir=true, run=false, mirror=false;
  if (irrecv.decode(&results))
  {
    byte ret=find_key(results.value);
    if (ret==254) last=254; // flush last key with invalid if invalid input is detected in case invalid remote sends out 0xffffffff that triggers repeat.
    else // For valid for this remote
    {
      if ((ret==255)&&(last!=254)) ret=last; // Make sure last key was not invalid before doing repeat.
      else last=ret;
      
      switch (ret)
      {
        case '0':
        current=0;
        break;
        
        case '1':
        current=1;
        break;
        
        case '2':
        current=B11;
        break;
        
        case '3':
        current=B111;
        break;
        
        case '4':
        current=B1111;
        break;
        
        case '5':
        current=B11111;
        break;
        
        case '6':
        current=B111111;
        break;
        
        case '7':
        current=B1111111;
        break;
        
        case '8':
        current=B11111111;
        break;
        
        case 'C':
        current++;
        break;
        
        case 'c':
        current--;
        break;
        
        case 'R':
        current=~current;
        break;
        
        case 'P':
        if (current==0) current=255;
        else current=0;
        run=false;
        mirror=false;
        break;
        
        case 'v':
        current=(current>>1)|(B10000000*(bitRead(current,0)));
        break;
        
        case 'V':
        current=(current<<1)|(bitRead(current,7));
        break;
        
        case 'L':
        forward_dir=!forward_dir;
        break;
        
        case 'T':
        run=!run;
        break;

        case 'A':
        mirror=!mirror;
        break;
      }
        
      updateLed(current);
    }
    irrecv.resume(); // Receive the next value
  }
  
  if (run)
  {
    if (forward_dir)
    {
      current=(current<<1)|(bitRead(current,7));
    }
    else
    {
      current=(current>>1)|(B10000000*(bitRead(current,0)));
    }
      updateLed(current);
  }
  
  if (mirror)
  {
    current=~current;
    updateLed(current);
  }
  
  delay(100);
}

char find_key(unsigned long code)
{
  const char codes[]="ML1470ST258-Iv369APVUCcR";
  byte col, row, temp;
  if (code==0xffffffff) return (255); // Repeat
  else if ((code&0xffff0000)==0x40bf0000)
  {
    temp=lowByte((code-0x40BF00FF)/0x7f8)<<3;
    for (byte i=0;i<8;i++)
    {
      bitWrite(col,i,bitRead(temp,7-i));
    }
    row=col>>2;
    col=col&B11;
    return (codes[col*6+row]);
  }
  else return 254; // Invalid code. Not from this remote control.
}

void updateLed(unsigned char first8)  // Updates LED status using shift registers.
{
  digitalWrite(myLatchPin, LOW);  // Disable update to the output buffers.
  shiftOut(myDataPin, myClockPin, LSBFIRST, first8);//MSBFIRST when flat LSBFIRST when standing.
  digitalWrite(myLatchPin, HIGH);  // Enable update to the output buffers.
}

5865  Community / Exhibition / Gallery / Re: Modular Stackable Microcontroller System (lots of pics) on: May 20, 2011, 11:02:19 pm
Agreed. I do have scrolling menu/list with many rendering options smiley

You can run two 40X2 displays or 2 20X4 displays with one arduino, just use different EN lines and make two lcd objects.

RE: number, nice and big! Here's my version, not only numbers are large, so are all other characters including letters and symbols smiley

http://liudr.wordpress.com/libraries/phi_super_font/



Again same set of lcd functions are required.
Pages: 1 ... 389 390 [391] 392 393 ... 517