Shop OBEX P1 Docs P2 Docs Learn Events
Intro / Newbie Question — Parallax Forums

Intro / Newbie Question

John MintonJohn Minton Posts: 23
edited 2010-06-10 20:27 in Propeller 1
Hello,

My name is John Minton. For the past 7 or so years I have been in love with PHP / MySQL. I went to the Parallax Propeller Expo a handful on months ago in Rocklin with my dad and was amazed at all that the propeller chip was capable of. Websites are getting kind of boring for me, though I still love the programming aspect of it. I have decided to move forward with another language and see what all is out there. I took a stab at C / C++, didn't get too far into it but all the tutorials I have read are either extremely vague or extremely detailed and complicated....lots of words I don't understand [noparse]:D[/noparse]

As of yesterday I decided it's time to give Spin a go, so I followed a short Blinky LED tutorial, then improvised a bit and made a few LEDs blink in different orders, different time, etc. It was exciting to see it work! I then played with printing text my the TV via tv_text which was also pretty fun! After a few more short experiments I decided that this is for me! I love it!

So now I have a small project idea that would help me really understand some core logic and syntax for the propeller but it seams that I don't really even know what to Google to figure out some of the questions I have for my idea. Upon taking a peak at the forums, I hope I can find some help here!


You ever see one of those clocks with a few LED's in a vertical line on a stick that swings left and right, and as the single row of LED's moves, it appears to have a message or the time / date? I think they may be referred to as a moving LED array.

I want to do something similar, except with out any moving parts. I want the LED's to say something as you move your head from left to right, but as you look directly at them you just see lit up LED's that appear to be slightly flashing.

I figure the single row of LED's is like viewing a single like of part of some text , but I need a way to make the entire row of LED's light up at the same time.


My lack of the Spin language, and the knowledge of PHP language has brought me the the very start of the project, but I am unsure of even what to do next.

Here is what I am starting with. I am sure you will be able to see where I am heading with it:

CON
led1 = 1 0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0 0 0 0 1 1 1 1
led2 = 1 0 0 1 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1
led3 = 1 1 1 1 0 1 1 1 1 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1
led4 = 1 0 0 1 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1
led5 = 1 0 0 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1


PUB main
dira[noparse][[/noparse]0]~~
dira~~
dira~~
dira~~
dira~~




Now I figure we need to pass the first numbers in the constants of led0 - led1 to outa[noparse][[/noparse]0..4].

I am not necessarily asking for anyone to program the whole thing out, though I would not mind that. I just don't really know how to proceed and grab those digits and display them all at the same time.

Thank you in advance!
500 x 375 - 82K

Comments

  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2010-06-09 18:55
    Those are called POV projects.
    just google POV clock and you will find
    lots of links.

    POV = persistence of vision
  • BeanBean Posts: 8,129
    edited 2010-06-09 18:55
    John Minton said...
    You ever see one of those clocks with a few LED's in a vertical line on a stick that swings left and right, and as the single row of LED's moves, it appears to have a message or the time / date? I think they may be referred to as a moving LED array.

    I want to do something similar, except with out any moving parts. I want the LED's to say something as you move your head from left to right, but as you look directly at them you just see lit up LED's that appear to be slightly flashing.
    John,
    · Have you tried this yet ?

    · I don't think it will work that way (LEDs still and head moving).

    Bean


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    If you choose not to decide, you still have made a choice. [noparse][[/noparse]RUSH - Freewill]
  • Mike GreenMike Green Posts: 23,101
    edited 2010-06-09 18:59
    First of all, you need to invert your array of bits so that LED1 corresponds to bit 0 of a byte, LED2 corresponds to bit 1, etc. Your sequence of LED on/off values would look like:

    table byte %11111, %00100, %00100, %11111, %10101, %10101, %10101, %10101
    byte ' and so on

    You'd then use this as a byte array and go through the values in order at whatever speed you want.
    dira[noparse][[/noparse]9..5]~~
    repeat i from 0 to 17
       outa[noparse][[/noparse]9..5] := table[noparse][[/noparse] i ]
       waitcnt(clkfreq/20 + cnt)
    


    The 9..5 just specifies a series of I/O pins and the waitcnt waits for 1/20th of a second.
  • John MintonJohn Minton Posts: 23
    edited 2010-06-09 21:03
    HollyMinkowski said...
    Those are called POV projects.
    just google POV clock and you will find
    lots of links.

    POV = persistence of vision


    I'll check it out! From the looks of it, this is exactly what I have been looking at.

    I was thinking it would be kind of cool to put messages in your tail lights! You ever see the newer cars with the LED tail lights that blink really bad...they probably give you a seizure if you stare at them too long....It's kind of what gave me the idea to modulate a message in there so that when you move your head you appear to see something that isn't really there when you look at it from a relatively stationary position!

    Thanks!
  • John MintonJohn Minton Posts: 23
    edited 2010-06-09 21:07
    Bean said...
    John Minton said...

    You ever see one of those clocks with a few LED's in a vertical line on a stick that swings left and right, and as the single row of LED's moves, it appears to have a message or the time / date? I think they may be referred to as a moving LED array.
    I want to do something similar, except with out any moving parts. I want the LED's to say something as you move your head from left to right, but as you look directly at them you just see lit up LED's that appear to be slightly flashing.
    John,
    Have you tried this yet ?
    I don't think it will work that way (LEDs still and head moving).
    Bean

    Hey Bean,
    I do know it will work. Weather the LED's are moving or your vision is moving, it's the relative movement between your eye and the LED's. Kind of hard to explain.

    I will be posting Youtube video, pictures, etc when I get it working. Like HollyMinkowski said: POV = persistence of vision.

    Thanks for the input!
  • John MintonJohn Minton Posts: 23
    edited 2010-06-09 21:14
    Mike Green said...
    First of all, you need to invert your array of bits so that LED1 corresponds to bit 0 of a byte, LED2 corresponds to bit 1, etc. Your sequence of LED on/off values would look like:

    table byte %11111, %00100, %00100, %11111, %10101, %10101, %10101, %10101
    byte ' and so on

    You'd then use this as a byte array and go through the values in order at whatever speed you want.
    dira[noparse][[/noparse]9..5]~~
    repeat i from 0 to 17
       outa[noparse][[/noparse]9..5] := table[noparse][[/noparse] i ]
       waitcnt(clkfreq/20 + cnt)
    


    The 9..5 just specifies a series of I/O pins and the waitcnt waits for 1/20th of a second.


    Thank you Mike!

    You know what I'm talking about! I am at work at the moment, but this looks like what I need! I'll tinker with it tonight and get back to you!!

    Thanks!
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-06-09 21:17
    I think what Bean is suggesting is that when you are moving the LEDs you can create a sync point so that the columns get displayed where they should; with fixed LEDs you'll simply have to multiplex them and hope that the user starts moving his/her head at the right time in order to correctly read the display.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • John MintonJohn Minton Posts: 23
    edited 2010-06-10 00:11
    JonnyMac said...
    I think what Bean is suggesting is that when you are moving the LEDs you can create a sync point so that the columns get displayed where they should; with fixed LEDs you'll simply have to multiplex them and hope that the user starts moving his/her head at the right time in order to correctly read the display.

    Yes, of course, I understand that. Thank you.

    I think that depending on how fast the person moves their hear will effectively change the horizontal spacing and width of the letters. But the goal is not so much to be obvious about the LEDs. My intent is to make it more of something that catches your eyes when you turn your head...then you look back and don't see what you saw before...then you look away again and see the words and it gets people kind of interested because it's not exactly a normal thing!

    The idea though just for fun is neat because it makes me think that you can embed alternate pictures or alternate video within video or other visual systems. I personally think that LEDs are a rather primitive means of accomplishing this but for the sake of learning the spin language I thought it would be fun. It's a means of displaying hidden or secret words or pictures!

    Thanks again for your input!
  • John MintonJohn Minton Posts: 23
    edited 2010-06-10 01:01
    Mike Green said...
    First of all, you need to invert your array of bits so that LED1 corresponds to bit 0 of a byte, LED2 corresponds to bit 1, etc. Your sequence of LED on/off values would look like:

    table byte %11111, %00100, %00100, %11111, %10101, %10101, %10101, %10101
    byte ' and so on

    You'd then use this as a byte array and go through the values in order at whatever speed you want.
    dira[noparse][[/noparse]9..5]~~
    repeat i from 0 to 17
       outa[noparse][[/noparse]9..5] := table[noparse][[/noparse] i ]
       waitcnt(clkfreq/20 + cnt)
    


    The 9..5 just specifies a series of I/O pins and the waitcnt waits for 1/20th of a second.


    So I have one question:

    table byte %11111 ....

    The compiler doesn't like this line for some reason. I assume table is the name of a variable, and each comma separated entry are the bits of each byte. The 11111 would turn all LED's on. 00100 Would turn them off except the middle LED, etc etc.

    I have tried a number of variations of "table byte %111111, %00000, "... as well as placing the code in the PUB main, or VAR, or CON blocks but get error messages upon compile such as:

    Expected BYTE, WORD or LONG
    Expected a unique variable name
    Expected "," or end of line

    ...I have seen some examples that use byte as:

    VAR
    byte var1,var2,var3,var4


    But I am not sure I understand what this means. Should I set variables prior that contain the byte info?

    Thank you for your help!!

    Post Edited (John Minton) : 6/10/2010 1:11:53 AM GMT
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-06-10 05:04
    Hello John,

    this compiles and should work

    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    
    VAR
      long i
      
    PUB Main
    
      dira[noparse][[/noparse]9..5]~~
      repeat i from 0 to 17
         outa[noparse][[/noparse]9..5] := table[noparse][[/noparse] i ]
         waitcnt(clkfreq/20 + cnt)
    
    DAT
      table byte %11111, %00100, %00100, %11111, %10101, %10101, %10101, %10101
    
    



    the line table ... missed the keyword "DAT" to define a DAT-section

    best regards

    Stefan
  • BradCBradC Posts: 2,601
    edited 2010-06-10 05:45
    Bean said...
    I don't think it will work that way (LEDs still and head moving).

    I've seen a couple of them, so they certainly do work. Neat idea, particularly in a bar full of inebriated patrons. It's funny to see 20 guys sitting at a bar swinging their heads around trying to read the message.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "I mean, if I went around sayin' I was an emperor just because some moistened bint had lobbed a scimitar at me they'd put me away!"
  • potatoheadpotatohead Posts: 10,261
    edited 2010-06-10 06:30
    Actually it will work very well, when the eyes are moving, or the head is rotating. Just moving the head laterally doesn't change the angle much.

    I too thought of the tail light message: FAIL (evil grin)

    Seriously, the frequency of emission should be much higher on vehicle LEDs. I've found night time considerably more distracting with LEDs that flicker. What ends up happening is constant lights blend in a way that seems to work well with our natural compensation for persistence of vision. The flickering LEDs leave image patterns that endure and obstruct other things.

    Having said that, since the things are currently permitted to flicker, a message would be fun!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Propeller Wiki: Share the coolness!
    8x8 color 80 Column NTSC Text Object
    Wondering how to set tile colors in the graphics_demo.spin?
    Safety Tip: Life is as good as YOU think it is!
  • Cats92Cats92 Posts: 149
    edited 2010-06-10 10:29
    Hello,
    people working with the Arduino microcontroller and Processing language have made things like that.
    Here you can find a POV and some explanation:
    http://carlitoscontraptions.com/2007/08/arduino-pov-prototype-part-2/

    Good luck !
  • John MintonJohn Minton Posts: 23
    edited 2010-06-10 20:27
    You guys are awesome!

    Thank you Stefan for explaining that code! I haven't got to run it yet but it makes perfect sense! I see how through each iteration of i we are specifying the byte we are working work from table. It is starting to look a little bit like PHP to me [noparse]:D[/noparse] it's a good thing cause it means I am learning!!

    Brad & PotatoHead: I would love to watch a bunch of bar folk shake their heads trying to read it [noparse]:D[/noparse] If we made it spit out a long message, a riddle or something, it could keep people occupied for hours!

    I guess the next step would be to create a txt string to "byte" converter so that one can easily update the message with a keyboard.

    I'll let you know how it works for me.

    Thanks for all the help and humor!
Sign In or Register to comment.