testing Bit-banging Pulse Width Modulation from http://arduino.cc/en/Tutorial/SecretsOfArduinoPWM, i started with:
void setup()
{
pinMode(13, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH);
delayMicroseconds(100);
}
however, i got 0.000 Hz and only about 1.?? mV
so i looped:
while(true)
{
digitalWrite(13, LOW); // also used digitalWrite(13, HIGH);
delayMicroseconds(i);
Serial.print(i);
Serial.print('\n');
i++;
if(i > 2000){i = 0;}
}
again, got same except a brief 7 something Hz at start, but did not repeat after loop restarted.
ok. checked 0 - 13
void setup()
{
// put your setup code here, to run once:
int i = 0;
while(i < 14)
{
pinMode(i, OUTPUT);
i++;
}
Serial.begin(9600);
}
void loop()
{
int i = 0;
int j = 0;
// put your main code here, to run repeatedly:
while(true)
{
digitalWrite(j, LOW);
delayMicroseconds(i);
Serial.print(i);
Serial.print(" , ");
Serial.print(j);
Serial.print('\n');
i++;
j++;
if(i > 2000){i = 0;}
if(j > 12){j = 0;}
}
}
pin# volts HZ
0 5.03 V 0.000
1 ~1.8 V ~2.5 kHz [very active]
2 4.1 mV 0.000
3 4.4 mV 0.000
4 4.4 mV 0.000
5 2.7 mV 0.000
6 2.9 mV 0.000
7 2.9 - 3.0 mV 0.000
8 3.1 mV 0.000
9 2.9 - 3.0 0.000
10 2.7 0.000
11 2.6 - 2.7 0.000
12 2.4 0.000
13 1.8 0.000
this makes no sense.
assuming pins 2 - 13 have different voltages due to contact of test wire to pins.
but why does pin 0 have zero Hz and 5 volts & pin 1 have ~2.5 kHz and ~1.8 V?
could someone explain what is going on?