Code

Post here to discuss the One Chip POV Display

Moderators: Chuckt, Garth, bitfogav

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
QuakerDeuce
newbie
newbie
Posts: 3
Joined: Tue Jan 25, 2011 2:06 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Code

Post by QuakerDeuce » Fri Apr 22, 2011 11:36 am

Hi Brad,
I have completed my POV display based on your one chip instructables and everything works like a charm. Thanks a lot for all the help!
I was wondering if you (or anyone else!) have ever written any code that allows a single image (80x8) to rotate constantly around the display.

I tried one based on your POV converter software that simply adds an increasing delay each time the sensor is tripped.

Code: Select all

y = 0
While True()                        // This creates an infinite loop
        If PORTE.bits(2) = 0 Then
          DelayMS(y)
          DisplayGraphics
          y=y+1
        EndIf

        If y = 100 Then   //Resets the delay after while so it doesn't keep getting longer
          y = 0
        EndIf
Wend  
The issue with this is that it runs into problems when the sensor is tripped during the delay (when the image is almost all the way around).
Perhaps there is a way to ignore sensor input while the DisplayGraphics function is running?
Just curious if you had any ideas or previous code addressing this problem, as you are a much more elegant programmer than myself.

Thanks again!

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Code

Post by brad » Fri Apr 22, 2011 2:12 pm

Ah yes, what you need is a delay that's not really a delay :D

To explain, what you need is similar to a simple button debounce routine. A simple piece of code for a button debounce would be:

Code: Select all

Sub CheckButton()
     If ButtonDebounce <> 0 then
          dec(ButtonDebounce)
     Else
          If ButtonPressed = true then
               ButtonDebounce = 10
               do this code here...
          Endif
     Endif
End Sub
This here will delay the button being repeat rate by adding a delay called ButtonDebounce. if the button has been pressed, it will do whatever code is assigned to that button, but it will also set the buttonDebounce delay (in this case it is 10) then, everytime the routine is called, it will decrement the variable by one and will only accept another button press when it has reached zero again. This way you can still delay the button presses but it does not hold up your code!

You could certainly implement this into your POV project :D

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: Code

Post by bitfogav » Fri Apr 22, 2011 6:58 pm

Hi QuakerDeuce,

If you get stuck implementing Brads delay into your code then you could post your full POV code and Ill see if I can help :)

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: Code

Post by brad » Fri Apr 22, 2011 9:37 pm

I have just created this new forum (for the one chip pov) and have moved this post here also.

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 7 guests