Shop OBEX P1 Docs P2 Docs Learn Events
Are SimpleIDE Terminal's special codes working? — Parallax Forums

Are SimpleIDE Terminal's special codes working?

DamirXDamirX Posts: 12
edited 2015-03-22 22:04 in Learn with BlocklyProp
Good time!

Sample of C - code:
#include "simpletools.h" // Include simpletools

int main() // main function
{
while(1) // Endless loop
{
high(26); // Set P26 I/O pin high
print(BEEP); // Shoud it BEEP?
print("*");
pause(30); // Wait 1/10 second
low(26); // Set P26 I/O pin low
pause(970); // Wait another 1/10 second
}
}

But there are no sound. Other codes did not work too.
All functions in simple ide options are turned on. If show hexadecimal Input is turned on some codes are printed, but BEEP does nothing.

What I'm doing wrong?

Comments

  • twm47099twm47099 Posts: 867
    edited 2015-03-22 19:54
    This code works to beep the computer attached to the propeller board, not the propeller board.

    You need to use the "run with terminal" option from SimpleIDE.
    /*
      BEEP_test.c
    
    */
    #include "simpletools.h"                      // Include simple tools
    
    int main()                
    {
    
      for(int i = 1; i <= 10; i++)
      { print("%c", BEEP);
        pause(300);
      }
    }
    
    

    On my computer I get the windows 'dunk' sound (windows defaultbeep) 10 times.

    Note that with Propeller C you can use the "printi()" function instead of "print()" and save about 4k bytes, as long as you are not printing a floating point number.

    Hope this helps
    Tom
  • twm47099twm47099 Posts: 867
    edited 2015-03-22 22:04
    I also wanted to point out that the argument for the "pause()" function is in milliseconds. So pause(30); waits for 30 milliseconds, and pause(970); waits for almost 1 second (970 milliseconds).

    Tom
Sign In or Register to comment.