Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumProgramming Questions & HelpSyntax › pinMode question

Page Index Toggle Pages: 1
pinMode question (Read 4148 times)
12/30/09 at 19:45:48

Tilade   Offline
YaBB Newbies
Bronx, NY

Posts: 3
*
 
I'm rather new to the language, but not coding in general.  I did a test last night where if an analog input reached a certain level, it triggered a digital pin high.  The only problem was that the output was lousy and only outputting about 100 mV from a 9V power supply. 

This morning I noticed that I forgot to define the digital pin as an output with the pinMode command.  Of course this was before leaving for work.  I'm anxious to know, would not defining a pinMode, but still instructing it to output at a certain time cause this behavior?  I would suggest that if this is a problem, to have the program throw an error when compiling if this is the case.

Thanks!
 
IP Logged
 
Reply #1 - 12/31/09 at 00:47:10

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
hi Tilade, I understand your concern, actually it is not a bug, it is the normal pin behavior when doing it as you did, of course it doesn't work as expected, but from the syntax's point of view it is not wrong, so the compiler would pass it. Detecting and reporting this as an error involves a very smart interpreter to do this kind of semantic validation.
 
IP Logged
 
Reply #2 - 12/31/09 at 06:49:05

Tilade   Offline
YaBB Newbies
Bronx, NY

Posts: 3
*
 
Thanks for the reply barragan.  I recompiled the code with the pinMode defined and it works perfectly.  It's fun learning the little runtime problems that I create and how to prevent them.  Thanks for the help!
 
IP Logged
 
Reply #3 - 12/31/09 at 17:49:33

barragan   Offline
YaBB Administrator

Posts: 939
*****
 
no problem Smiley
 
IP Logged
 
Page Index Toggle Pages: 1