May 04, 2024, 03:23:39 PM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


New Template and FC-4+ and AP-16

Started by Laytonk, December 02, 2015, 01:16:20 PM

Previous topic - Next topic

Laytonk

Hello I just downloaded your new HC-8+ template, however I am having few problems, First when I compile code I get an Error Box stating expected an instruction or variable. The compiler stops at my first OUTS Command (outs.high(0)). I am also having an issue with volume control with my AP-16 it seems to ignore the command I changed "G" command to a "L" command but no luck. lastly how do we set up the FC-4+ with the new template? I have Included a copy of the spin code I am using. 
Components used 1 - HC-8+, 1 - AP-16, 2 - FC-4+.
Thanks so much.

JonnyMac

December 02, 2015, 02:55:43 PM #1 Last Edit: December 03, 2015, 09:48:57 AM by JonnyMac
Propeller troubleshooting 101: When the compiler complains, check the names of your objects. You were using outs.high(0) when the program was expecting pwm.high(0). I have uploaded a new template that changes that name back to outs -- hopefully that will reduce compatibility issues with older code.
Jon McPhalen
EFX-TEK Hollywood Office

Laytonk

Thanks so much that helped, however i have a question about the levels command for the AP-16, when I set my code to to start the AP16 at 25% it does nothing but start SFX00, no volume change, however if I put a time.pause between the two it sets volume and starts SFX00. After a trigger event I have the same problem, if I have a volume command followed by a play command nothing happens, if I insert a pause between the two the volume changes then SFX01 plays, I have also tried this with the AP-16 relay with the same results. Am I missing something should I use or do I need the pause?

Below is code that works..
I am using Template 12-2 rev E

repeat
    ap16_volume(%00, 25, 25)                                   ' set volume to 25%
    time.pause(500)
    ap16_sfx(%00, 0, 0)                                              ' play SFX00 (ambient for prop) in loop 


    repeat                                                                    ' wait for trigger on IN0
      if (ttl_pin == 0)
        quit 
   
Keith


    outs.high(0)                                                            ' prop moves
    outs.high(2)                                                            ' strobe on
       

    ap16_sfx(%00, 1, 0)                                               ' play SFX01
    time.pause(500)
    ap16_volume(%00, 50, 50)                                    ' set volume to 50%
                               

JonnyMac

Technically, you should be able to drop commands one after the other because the serial is buffered. That said, it wouldn't hurt to put at least a 25ms pause between commands (that is the internal timeout value) to ensure it's ready when you send something.

As I am working on the V2 code right now, I will see if this can be improved.

As a matter of practice, it's a good idea to set your initial volume and playback speed before starting the file. Again. I won't hurt to insert at 25ms delay between commands.
Jon McPhalen
EFX-TEK Hollywood Office