|
3 | 3 | |
4 | 4 | Main Functions: |
5 | 5 | * ENABLE/DISABLE Laser -> Pin 13 + LED |
6 | | - * SET Laser Current -> Pin 11 |
| 6 | + * SET Laser Current -> Pin 11 (Changed to 31 kHz |
7 | 7 | * GET Laser Current -> A0 |
8 | 8 | LDC500 -> k=50mA/V |
9 | 9 | |
@@ -33,30 +33,13 @@ const int dht22Pin = 8; |
33 | 33 | String inputString = ""; // a string to hold incoming data |
34 | 34 | boolean stringComplete = false; // whether the string is complete |
35 | 35 |
|
36 | | -// Change PWM Frequency for Timer2. |
37 | | -// Copied the relevant part from here: |
38 | | -// http://playground.arduino.cc/Code/PwmFrequency |
39 | | -void setPwmFrequency(int pin, int divisor) { |
40 | | - byte mode; |
41 | | - if(pin == 3 || pin == 11) { |
42 | | - switch(divisor) { |
43 | | - case 1: mode = 0x01; break; |
44 | | - case 8: mode = 0x02; break; |
45 | | - case 32: mode = 0x03; break; |
46 | | - case 64: mode = 0x04; break; |
47 | | - case 128: mode = 0x05; break; |
48 | | - case 256: mode = 0x06; break; |
49 | | - case 1024: mode = 0x7; break; |
50 | | - default: return; |
51 | | - } |
52 | | - TCCR2B = TCCR2B & 0b11111000 | mode; |
53 | | - } |
54 | | -} |
55 | | - |
56 | 36 | void setup() { |
57 | 37 | pinMode(laserREM, OUTPUT); |
58 | 38 | pinMode(laserMod, OUTPUT); |
59 | | - setPwmFrequency(laserMod, 1); |
| 39 | + // Change PWM Frequency for Timer2. |
| 40 | + // Copied the relevant part from here: |
| 41 | + // http://playground.arduino.cc/Code/PwmFrequency |
| 42 | + TCCR2B = TCCR2B & 0b11111000 | 0x01; |
60 | 43 | Serial.begin(115200); |
61 | 44 | // reserve 200 bytes for the inputString: |
62 | 45 | inputString.reserve(200); |
|
0 commit comments