How to read the state of an output pin ?


hi.

i'm trying read output state of output pin seams not working.

i've got tihs :

code: [select]
digitalwrite(10, high);
statepin10 = digitalread(10);
if (statepin10 == high)
{
dutycycle = map (ubat100, 1340, 1445, 100, 220);    
dutycycle = constrain(dutycycle, 100, 220);      
analogwrite(8, dutycycle);  
}


but doesn't analogwrite on pin n°8 (only 0).

if i' m not doing right, how can know state of output pin ?

i'm not sure can digitalread() output pin. might have keep track of state manually:

code: [select]
digitalwrite(10, high);
statepin10 = high;





Arduino Forum > Using Arduino > Programming Questions > How to read the state of an output pin ?


arduino

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial