Pages: [1]   Go Down
Author Topic: analogWrite low for ground  (Read 388 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
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
Shannon Member
****
Karma: 223
Posts: 12631
-
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

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 52
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: 98
Posts: 4801
I learn a bit every time I visit the forum.
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

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Pages: [1]   Go Up
Jump to: