Skip to content

Commit c4bf47a

Browse files
committed
Finnishing touches with new Timer2 frequency and calibrations fine tuned by hand.
1 parent bdb57d9 commit c4bf47a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ldc500/ldc500.ino

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,25 @@ void setup() {
3939
// Change PWM Frequency for Timer2.
4040
// Copied the relevant part from here:
4141
// http://playground.arduino.cc/Code/PwmFrequency
42+
// f=~31kHZ
4243
TCCR2B = TCCR2B & 0b11111000 | 0x01;
4344
Serial.begin(115200);
4445
// reserve 200 bytes for the inputString:
4546
inputString.reserve(200);
4647
}
4748

4849
void setCurrent(float i) {
49-
if (i > 100.00) { i = 100.00; }
50-
int iDigit = i*1.97;
50+
// Lock to Max.
51+
if (i > 100.00) { i = 110.00; }
52+
int iDigit = i*1.535;
5153
analogWrite(laserMod, iDigit);
5254
Serial.println("OK\r");
5355
}
5456

5557
float getVoltage() {
5658
int ctlOut = analogRead(laserCTL);
5759
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
58-
return ctlOut*0.0049; // voltage
60+
return ctlOut*0.005; // voltage
5961
}
6062

6163
float getCurrent() {

0 commit comments

Comments
 (0)