Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
fabricademy2017:classes:wearables1 [2017/10/27 11:57]
staff
fabricademy2017:classes:wearables1 [2017/10/27 19:04] (current)
staff
Line 133: Line 133:
 //MAKE SOUND:\\ //MAKE SOUND:\\
 if(sensorValue < 900){ noiseFrequency = map(sensorValue,​ 0, 1023, 100, 10000); noise (speakerPin,​ noiseFrequency);​ } //FADE LED: ledBrightness = map(sensorValue,​ 0, 1023, 0, 255); analogWrite(ledPin,​ ledBrightness);​ } // MAKE SOUND ON THE ATTINY WITHOUT THE SOUND LIBRARY: void noise (unsigned char noisePin, int frequencyInHertz) { long delayAmount = (long)(1000000 / frequencyInHertz);​ digitalWrite(noisePin,​ HIGH); delayMicroseconds(delayAmount);​ digitalWrite(noisePin,​ LOW); delayMicroseconds(delayAmount);​ } —- // if(sensorValue < 900){ noiseFrequency = map(sensorValue,​ 0, 1023, 100, 10000); noise (speakerPin,​ noiseFrequency);​ } //FADE LED: ledBrightness = map(sensorValue,​ 0, 1023, 0, 255); analogWrite(ledPin,​ ledBrightness);​ } // MAKE SOUND ON THE ATTINY WITHOUT THE SOUND LIBRARY: void noise (unsigned char noisePin, int frequencyInHertz) { long delayAmount = (long)(1000000 / frequencyInHertz);​ digitalWrite(noisePin,​ HIGH); delayMicroseconds(delayAmount);​ digitalWrite(noisePin,​ LOW); delayMicroseconds(delayAmount);​ } —- //
 +
 +{{:​fabricademy2017:​classes:​37642075700_1659bc4772_o.jpg?​nolink&​1484x900}}
  
 //​[[https://​github.com/​plusea/​CODE/​blob/​master/​WORKSHOP CODE/​Fabricademy/​ATtiny-code-example/​ATtiny-code-example.ino|Arduino source code//]]// //​[[https://​github.com/​plusea/​CODE/​blob/​master/​WORKSHOP CODE/​Fabricademy/​ATtiny-code-example/​ATtiny-code-example.ino|Arduino source code//]]//