Shop OBEX P1 Docs P2 Docs Learn Events
what am I doing wrong — Parallax Forums

what am I doing wrong

Shining IvyShining Ivy Posts: 5
edited 2010-03-01 22:37 in Propeller 1
Hello I am trying to create a environmental control unit that monitors and controls the Temp. Humidity, CO2, Light, Particle Suspension, Air flow, Ect. For now I am just trying to have the humidity be controlled simply by an I/O pin going high or not (have to learn to walk before I can run). Currently I am using the sensirion sht.11. with a modified Demo. The sensor is working fine. I am trying to use global variables that can be passed to another object that is running its own cog.

So I start the new cog in the new object and declare the global variables to it. Then I run the objects method with an "if statement" declaring local variables equal to the global. Then I run the program. The sensor is displaying values, but the I/O are doing nothing. I am new to ucontrollers and to programing and I am sure I have missed something, any help would be greatly appreciated.

Comments

  • mparkmpark Posts: 1,305
    edited 2010-02-27 01:33
    Shining Ivy said...
    Then I run the objects method with an "if statement" declaring local variables equal to the global.

    I don't see an if statement in the code you attached...
  • Shining IvyShining Ivy Posts: 5
    edited 2010-02-27 01:43
    sorry left one out here it is.
  • mparkmpark Posts: 1,305
    edited 2010-02-27 02:47
    I think 13.14 should be 13..14
  • John AbshierJohn Abshier Posts: 1,116
    edited 2010-02-27 04:45
    in main: monitor.start(@Rawtemp, @RawHumidity, @tempC1,@Rh1, @dewC1) you are passing addresses, good
    in relay.start : pub start(RawTemp1, RawHumidity1, tempC1, Rh1, DewC1) : success these parameters are addresses
    in relay.start: success := (cog := cognew(relay(@RawTemp1, @RawHumidity1, @tempC1, @Rh1, @DewC1), @stack) + 1) you are passing the address of the address. I don't think you need the @ operator here.

    John Abshier
  • Shining IvyShining Ivy Posts: 5
    edited 2010-03-01 22:37
    Mpark thank you [noparse][[/noparse]13.14] needed to be [noparse][[/noparse]13..14]

    John Abshier you are right the @ operator didn't need to be there.

    Okay so I fixed the [noparse][[/noparse]13.14] to [noparse][[/noparse]13..14] removed the @ operator, but I still cannot toggle a an I/O to go high.

    Is there a problem with the global variable being a result of a floating point?

    I tried to do a float point comparison which says in the comments brings back a 1, 0, or -1 depending on the comparison between two floating points. I also converted a number.X to a floating point for this comparison yet still nothing. I thought that it could have been because I was doing this in another object, so I did the comparison in the parent object then wrote the result 1, 0 or -1 to a global variable then passed that variable to a new object with new cog to toggle an I/O pin based on what was in the global variable, and yet still nothing. Converted the floating point to an integer to do a comparison and still nothing.

    All I am trying to do is if the sensor reading is greater, less then, or equal to a value do something. What am I doing to make this so complicated and not work.

    Thank you,

    Shining Ivy
Sign In or Register to comment.