Loading...
Pages: [1]   Go Down
Author Topic: analogWrite low for ground  (Read 120 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

sorry if this is in the wrong place, this seemed to fit it best.
if i use analogWrite function to write a pin (non pwm) to low, that makes it a ground. i know it works because i have tried it. but...will this do any type of damage to the arduino?
Logged

UK
Offline Offline
Tesla Member
***
Karma: 89
Posts: 6391
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It'll be fine, as long as you don't ask it to sink more than about 20mA.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It'll be fine, as long as you don't ask it to sink more than about 20mA.
ok. thank you!
Logged

Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 31
Posts: 2936
I only know some basic electricity....
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

if i use analogWrite function to write a pin (non pwm) to low,

Why use analogWrite to a non-pwm pin at all?
Write the pin LOW and set it to OUTPUT.

And here's the fun part. You can switch modes and states in no time flat on the same pin. It's not set in stone, it's made to be versatile and fast.

Some of the neatest code does that. There's a sketch that uses 2 pins, 1 led and 1 resistor to read the ambient light level with the led then change to pulse the led to make light at controlled brightness so it's not too bright or too dim.. many times a second. Just to read light with a led uses mode and state switching.

Logged

Examples can be found at Learning in the Main Site and at the Playground

Pages: [1]   Go Up
Print
 
Jump to: