Advertisement
Guest User

Untitled

a guest
Jan 7th, 2021
1,386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. /*
  2.      code used in jamuary02 - Bytebeat
  3.      https://youtu.be/8HQUXlStqK8
  4.      schematic at https://imgur.com/SekUTgN
  5.      noizhardware.com
  6.      enjoy :)
  7. */
  8. #include <avr/io.h>
  9.  
  10. #define SNDOUT 4 /* pin3 */
  11. #define POT_A 3 /* pin2 */
  12.  
  13. uint8_t out;
  14. int16_t t = 0;
  15. uint8_t PARAM_A;
  16. uint16_t potA16;
  17.  
  18. void setup(){
  19.      pinMode(SNDOUT, OUTPUT);
  20.      pinMode(POT_A, INPUT);}
  21.  
  22. void loop(){
  23.      potA16 = analogRead(POT_A);
  24.      PARAM_A = (int)(potA16>>2); /* ditch bits to go from 10bit to 8bit */
  25.  
  26.      out = (t%127)*((t-65&t)>>(PARAM_A/14+7));
  27.  
  28.      digitalWrite(SNDOUT, out);
  29.      
  30.      t++;}
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement