I've only had barely 1 month to learn Arduino for my new media art class and we've had less than a week to work on our transduction project. (last Thursday until this coming Thursday). My project is using a phototransistor to control a DC motor. Like the brighter the light the more it spins, the less the more it slows or stops. I think my circuit is okay because the motor works, but the phototransistor does not respond to light or darkness. Even my professor couldn't figure out what was wrong but I assume that my coding is wonky. I bought the starter kit and combined the code from the Light Theremin and Motorized Pinwheel projects.
int sensorValue;
int sensorLow = 1023;
int sensorHigh = 0;
const int ledPin = 13;
const int motorPin = 9;
it's a phototransistor. It looks like an LED except it has a flat top. I used it when I first was trying Arduino and I made a theremin that used it to change the pitch of a piezo.
Please use code tags when posting code. You can edit your post and
type ** **[code]** **
before your code
type ** **[/code]** **
after your code
OK, your setup() determines a low level. In loop you compare against that low level using '=='. Chances that the sensorValue is exactly that low level are not that big. You might want to use '<=' instead