Reading data from a sensor in SimpleIDE
cesar1102
Posts: 2
Hello, I'm new using propeller. I was working with arduino, and now after looking pretty and finding nothing, I would like to know if there is the equivalent of "digitalWrite","digitalRead","analogRead" and "analogWrite" using SimpleIDE.
Thanks!
Thanks!
Comments
This tutorial should get you started.
http://learn.parallax.com/tutorials/language/propeller-c/propeller-c-simple-circuits
You can use the high() and low() function to write to I/O pins and the input() function to read them.
What sensor do you want to use and what Propeller board are you using?
The Propeller Activity Board has both an ADC and a DAC along with functions for using them.
Forgive me but I am not as familiar with Propeller C as I am with Spin which is the Propeller's native language.
Under the 7-segment display I see 2 additional functions set_directions() and set_outputs().
This set of tutorials might also be useful.
http://learn.parallax.com/tutorials/language/propeller-c/propeller-c-simple-devices
This too.
http://learn.parallax.com/tutorials/language/propeller-c/propeller-c-simple-protocols
Some of the functions such as shift_out() and shift_in() are based on BASIC Stamp 2 commands.
high(), low(), and pause() are also BASIC Stamp 2, or BS2, commands.
Some sensors also use I2C.
Yesterday I was testing the HC-SR04 sensor, but I did not get the correct readings. Since I could not find a solution I had to resort to the forum.
And I use the Parallax QuickStart.
I am not familiar with the HC-SR04 but a number of others do.
First of all, does it work with your Arduino so we can rule out a bad sensor.
Here is a Propeller specific setup.
http://propellerpowered.com/shop/?page_id=1789
Try this code.
http://forums.parallax.com/discussion/157917/getting-started-with-a-4-pin-ping-sensor-hc-sr04
Someone made this C library.
http://forums.parallax.com/discussion/149014/added-hc-sr04-ping-sensor-to-c-library
From what I have read this sensor functions similarly to the Parallax Ping))) module but the Ping has one that you send a start pulse to and get the echo pulse from while the HC-SR04 has a pin for each pulse.
- Can you show how you wired it up, and post your code?
- Did you get any readings at all?
- If yes, what kind of values were you getting compared to what you were expecting?