Shop OBEX P1 Docs P2 Docs Learn Events
Blinky Lights — Parallax Forums

Blinky Lights

rokickirokicki Posts: 1,000
edited 2006-12-14 05:10 in Propeller 1
Here's a quick challenge that everyone with a demo board should be able to participate in.
(Or even those without, if they are willing to wire up 8 LEDs.)

What's the coolest blinkinglights program you can write? Spin or assembly, doesn't matter.
Output is restricted to eight LEDs in a row. Consider this a minimal demoscene contest.

No prizes, no deadlines, just what can you do? Short and elegant is nice, but if you can
manage to convey a story with only eight LEDs, a long submission is fine too.

I'll probably write one tonight just to get the ball rolling.

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-12-06 00:26
    That would be Beau's POV display, by waving it characters appear in the air.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • acantostegaacantostega Posts: 105
    edited 2006-12-06 02:22
    Hmm ... while I should've been studying for a final I had today I messed around a bit with an attempt to make an (inefficient) cellular automaton on the Prop. I just went with Wolfram's rule 90 (it can be done in a more efficient way with XOR) and didn't even try to enforce any sort of global synchronization. The idea is that each cog is a cell, and each cell corresponds to a led. Port A is used by each cog to assess the state of its neighbors. It doesn't seem to work, though. It kinda cycles between two or three states that don't seem to correspond to what should be seen (rule 90 forms a sierpinski carpet, although you won't be able to see anything like that in 8 leds).
    While a cog per cell is inefficient, I guess it's truer to the spirit of CAs. It also opens up the possibility of asynchronous CAs, although other rules apply in that case.
    Maybe the clock.spin module can be used for global synch.
    Anyway, here's the code. I don't have a demo board, I just wired 8 leds. Perhaps someone can fix it. I think there's an issue with my arithmetic.
    Ok, off to study. Won't be free until December 11th smile.gif
  • SSteveSSteve Posts: 808
    edited 2006-12-06 14:47
    Paul Baker (Parallax) said...
    That would be Beau's POV display, by waving it characters appear in the air.
    Do you have a link to that?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    OS-X: because making Unix user-friendly was easier than debugging Windows

    links:
    My band's website
    Our album on the iTunes Music Store
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2006-12-06 17:09
    http://forums.parallax.com/showthread.php?p=574673

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2006-12-06 17:40
    wow it was hard to spot how cool that example is without your glasses on. A version for my bike wheels may be needed.

    Graham
  • Steve Hicks (N5AC)Steve Hicks (N5AC) Posts: 20
    edited 2006-12-14 05:10
    I did this one several weeks ago for a product.· I needed to have an easy way to show the status of a number of devices with a minimal amount of hardware.· What I chose to do was to use a row of four dual-color LEDs (Red and Green LED with common cathode).· This routine was originally conceived with eight ports wired like this: R1, G1, R2, G2, R3, G3, R4, G4.· As it turns out I got a few wires flipped around during implementation and the board I am using is actually wired as R1, G4, R2, G3, R3, G2, R4, G1 on ports numbering 0-7.· At any rate, the routine allows the setting of any of the four "virtual LEDs" numbered 1-4 to RED, GREEN, or YELLOW (both LEDs on).· In addition, they can be set to flash slow or fast or even "blink."· For example, for my GPS with a 3D lock, my LED will be a solid GREEN color, but as data is received from the GPS, the LED blinks RED for a few milliseconds.· When the GPS is not available (no data), the LED blinks fast red, signalling an error.· When first turned on (cold start), we are receiving data and so the LED flashes a slow RED color.· With a 2D lock, it becomes a solid YELLOW... get the idea?

    Anyway, the routine can be shorter if the LEDs are wired as I had planned, but you get the point and rearranging the code for a different wiring scheme is left as an exercise for the reader ;-)

    I hope it's farily explanatory from looking at the code because there's not a lot of comments as I recall .. I was developing at warp 9...

    Here's an example of the routine in operation:

    CON
      ' set pin numbers for all pins connected on board
      #0, RadioOut, RadioIn, PTT, Button, JP0, JP1, JP2, JP3, LR1, LG4, LR2, LG3, LR3, LG2, LR4, LG1
      #16, DX_O, DX_I, DO_O, DO_I,TTS_I, TTS_O, TTS_BUSY, TTS_RESET, L0, L1, L2, L3
    
     
    CON
      ledGPS = 0
      ledDATA = 1
      ledA = 2
      ledB = 3
    
     
    VAR
      
    OBJ
      LED: "LEDcontrol"
    
     
    PUB Start
      DIRA := %00001111_00000000_11111111_00000100          ' setup all 12 LEDs as outputs for this cog
      
    
      LED.Init(LR1,LG1,L0,L3)                               ' start the LED control cog
      LED.set(ledDATA,LED#LEDgreenOn)                       ' light initializing LED
      'GPSbase := GPS.init(DX_I,DX_O)
      LED.set(ledGPS,LED#LEDredSlow)                        ' light initializing LED
    
    


    Oh, and shhhhh .... don't tell anyone I used a cog just to blink LEDs !!!

    73,
    Steve

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Steve, N5AC
Sign In or Register to comment.