Fast DACUsing direct bit manipulation on UNO port instead of using digitalWrite. Mucho mucho faster FAST PORT DAC 8-bit on Arduino UNO Arduino pins 2-9 == lsb-msb void setup() { lsb pin2 – msb pin 9 init for output for (int i = 2 i < 10; i) { pinMode (i,OUTPUT); } } void setDAC(unsigned char DACVal) { PORTD = (DACVal << 2) | (PORTD & B00000011); PORTB = (DACVal >> 5) | (PORTB & B11111100); } unsigned char c=0; void loop() { setDAC(c); c; overflow so yout get 0..255.,0..255 stc use scope to test speed } Raw code is here |