Shop OBEX P1 Docs P2 Docs Learn Events
sqaurewave.spin — Parallax Forums

sqaurewave.spin

mikeamikea Posts: 283
edited 2014-03-10 15:26 in Propeller 1
Hi, I was working on a project from the pe kit and need the "squarewave.spin" file for my library. I cant seem to find it in the obex. Does anyone know where I can find that? Thanks.

Comments

  • mikeamikea Posts: 283
    edited 2014-03-06 19:09
    Thank you Bob!
  • mikeamikea Posts: 283
    edited 2014-03-06 22:38
    I'm having trouble opening the square wave file. It seems to be because its a .php file which adobe xI won't work with. I tried unsuccessfully downloading Microsoft php file manager. I don't recall having problems downloading files from parallax before, Is the .php newer? Has anyone had this Problem?
  • twm47099twm47099 Posts: 867
    edited 2014-03-06 23:16
    mikea wrote: »
    I'm having trouble opening the square wave file. It seems to be because its a .php file which adobe xI won't work with. I tried unsuccessfully downloading Microsoft php file manager. I don't recall having problems downloading files from parallax before, Is the .php newer? Has anyone had this Problem?

    Click on the second link that Bob posted. That takes you to the forum thread: PE Kit Tools: Transmit Square Wave Frequencies

    Scroll down to just before the section labeled: Square Waves in Differential Mode

    About 4 lines above that section title is :
    P······ Download and unzip “PE Kit Tools – Square Wave Frequencies.zip”.

    Do that. ** Actually, I found out that the link was attached to this post, so just click on the link above, save it, and unzip it.

    Be sure to unzip the file. I was not able to open SquareWave.spin from the zip file. But once I saved and unzipped it, I was able to open all the files.

    Hope this helps
    Tom
  • mikeamikea Posts: 283
    edited 2014-03-07 03:12
    Thanks Tom, I must be missing the program that unzips. I downloaded and saved it. The only options it gives me are adobe(which won't work yet) and search the internet. I'll try to find something to unzip it tonight. Thanks again.
  • AribaAriba Posts: 2,690
    edited 2014-03-07 03:29
    Here is the extracted file:
  • msrobotsmsrobots Posts: 3,709
    edited 2014-03-07 12:04
    the problem here is that since a while all attachments lost there filename on download.

    Them show up as attachment.php and you have to 'save as' and add the correct extension '.zip' by yourself.

    Enjoy!

    Mike
  • mikeamikea Posts: 283
    edited 2014-03-07 16:06
    Thanks for your replies. What would be a correct extension zip? I tried to download from the link on aribas post but I ended up in the same place where I was stuck.
  • msrobotsmsrobots Posts: 3,709
    edited 2014-03-07 16:58
    Well - click on the link and say 'save as' then replace the name 'attachment.php' by the original name of the link.

    so when you click on 'SquareWave.spin' replace 'attachment.php' by 'SquareWave.spin.'

    when you click on 'SquareWave.Zip' replace 'attachment.php' by 'SquareWave.Zip.'

    Enjoy!

    Mike
  • mikeamikea Posts: 283
    edited 2014-03-08 10:08
    It worked...thank you!
  • mikeamikea Posts: 283
    edited 2014-03-09 07:13
    How durable are the ir receiver modules? I'm trying to duplicate the square wave exercise from pe kit. I have it set up as per pe kit, although early on I had 1k resistor on data pin rather than the 10k. at some point I switched up and output 3.3v at 38 kHz to the output pin of the ir receiver mod. Not sure if I fried something, im not seeing any changes in the serial terminal as detecting anything. yesterday it would detect, but it was very jittery so not sure if it was a true signal because this happened even with ir led covered and also with ir detector covered.
  • mikeamikea Posts: 283
    edited 2014-03-09 10:40
    Update...I know the ir led works, I slowed the freq down and can see it flash through the camera on my phone. somehow my computer crashed and works again, and now the ir detector as seen in the serial terminal is back to jittering. I tried a 10 k res. to grd and also to 3.3 (along with 1k to the prop pin for protection) to make sure the pin couldn't float but it still jitters. I also replaced the ir receiver with a pushbutton and everything else works correctly. The ir detector says it has an elliptical lens to block light below and above 38 kHz. I've tried different freq around 38 but am having no luck. sounds like a fried ir detector? Should I try something else?
  • cavelambcavelamb Posts: 720
    edited 2014-03-09 12:16
    I've not damaged one electrically, but they will not take any physical abuse at all.
    Just bending pins cab cause internal damage.
  • mikeamikea Posts: 283
    edited 2014-03-09 15:04
    I think the ir receiver I had was defective. I picked up another one and can see a reaction on the serial terminal from the tv remote. So I think the only thing left is that the ir led isn't pulsing at 38 kHz. Not sure how to check that. I don't have an o-scope. In the squarewave object there is this line .....PUB Freq(pin, module, frequency). I have it as per pe kit lesson, but not sure what "module" is. It has it as "0". I'm assuming its counter module but I thought those were referred to as "a" and "b".
  • mikeamikea Posts: 283
    edited 2014-03-09 17:28
    I'm trying to see if the ir led is really getting 38 kHz with posedge counter, but I'm not sure if I have that right. Does this code look like it would work? phsb amounts to zero, I was hoping for 38k +/-.
    CON
    _clkmode = xtal1 + pll16x ' System clock → 80 MHz
    _xinfreq = 5_000_000
    OBJ
    pst : "Parallax Serial Terminal"
    SqrWave : "SquareWave"
    PUB IrDetect | herz
    'Start 38 kHz square wave
    SqrWave.Freq(1, 0, 38000) ' 38 kHz signal → P1
    dira[1]~ ' Set I/O pin to input when no signal needed
    dira[12]~
    ctrb[30..26]:=%01010
    ctrb[5..0]:=12
    frqb~
    phsb~
    pst.Start(115_200)
    waitcnt(clkfreq*5+cnt)
        
        dira[1]~~ ' I/O pin → output to transmit 38 kHz
        waitcnt(clkfreq+ cnt) ' Wait 1 ms
        
        dira[1]~ ' I/O pin → input to stop signal
        herz:=phsb
        pst.dec(herz)
    
  • kuronekokuroneko Posts: 3,623
    edited 2014-03-09 17:55
    @mikea: You get what you asked for. frqb~ clears frqb and 38k*0 is still 0. Either use frqb~~ or frqb := 1.
  • cavelambcavelamb Posts: 720
    edited 2014-03-09 19:21
    Or?
    Load the IR remote control object and set a TV universal remote to Sony.
    See if the detector detects that?
  • mikeamikea Posts: 283
    edited 2014-03-10 03:55
    I think this new receiver is ok. It will respond to a Sony remote and Samsung , the 2 that I tried. When I get home I will change frqb and try again. Thank you.
  • mikeamikea Posts: 283
    edited 2014-03-10 15:26
    I corrected the frqb, and the ir led put out 38001 hz. Still nothing, so I rearranged the circuit on the breadboard and now it works. I'm not sure if the wires were inducing a signal upon each other, but they are separated now and it works. Thanks for the help.
Sign In or Register to comment.