RCTIME Command
436353
Posts: 5
As long as i remember u can't have analog input signals in basic stamps but RCTIME command is used to get variable resistance with out any converter rite? and PWM command to output a variable voltage. Can i use RCTIME command coming from photo resistors and use the variable resistance to control an output?
Comments
Well I was going to use the photoresistor to modulate the servo motor, so I don't think im gonna use the PWM statement (so no analog buffer rite?). Sorry another noob question, im not really familiar with Basic Stamps (did some readings tho). Let say the value of resistance of the Photoresistor is X at certain light and Y at certain light. Now can i use those values to move the servo motor to a specific position. We are actually building an automated window blinds. The main purpose is to modulate (not open and close) the blinds according to how much light there is inside the room and outside the room. I was hoping to do this without the A/D converter since the shipment would be too much for us (we're in Canada and authorized dealers here don't seem to have the A/D converter, or we just didn't look hard enough). I did check Ch 7 of "What's a Microcontroller?" can i use the circuit from there with some change in program and adding custom program to it? Sorry for all the question, I have little time (4 weeks) to come up with a solution.
Thank you
The RCTIME statement and the photoresistors will give you a number that's proportional to the light level, but it won't be anything like linear. The servo would be controlled with a PULSOUT statement and the servo position would be proportional to the number given in the PULSOUT statement. What you will need is some kind of mapping, probably with a table of RCTIME values and corresponding PULSOUT values. Your program would search the table (stored in EEPROM using READ and DATA statements) for the nearest entry to the RCTIME statement result and provide the corresponding value from the table for the PULSOUT statement to use to move the servo.
This has been a great help. I read up on how to control the servo with PULSOUT statement earlier. Just wasn't sure about analog inputs. This has cleared many confusions. Hopefully I will be able to write the program now. Again thank you very much.