Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
fabricademy2017:students:anamaria.martinlopez:week5 [2018/06/07 19:58]
anamaria.martinlopez [Circuit:]
fabricademy2017:students:anamaria.martinlopez:week5 [2018/08/28 10:18]
anamaria.martinlopez old revision restored (2018/08/19 09:44)
Line 116: Line 116:
 Without condenser! Without condenser!
  
-Download the Arduino software and install itArduino software and install it \\ Download the ATtiny folder and save it in the "​hardware"​ folder of the Arduino folder sketchesATtiny folder and save it in the "​hardware"​ folder of the Arduino sketches folder \\ Restart ArduinoArduino \\ Open the "​ArduinoISP"​ sketch in the "​Examples"​ folder \\ Select "​Arduino"​ One "from the menu" Tools> Board "​Arduino"​ One "from the menu" Tools> Board " \\ Select from the Tools menu> Serial Port \\ Load the sketch+Download the Arduino software and install itArduino software and install it\\ 
 +Download the ATtiny folder and save it in the "​hardware"​ folder of the Arduino folder sketchesATtiny folder and save it in the "​hardware"​ folder of the Arduino sketches folder\\ 
 +Restart ArduinoArduino\\ 
 +Open the "​ArduinoISP"​ sketch in the "​Examples"​ folder\\ 
 +Select "​Arduino"​ One "from the menu" Tools> Board "​Arduino"​ One "from the menu" Tools> Board "\\ 
 +Select from the Tools menu> Serial Port\\ 
 +Load the sketch
  
 Using your Arduino ISP to program an ATtiny microcontroller Add capacitors and programming connections! Arduino ISP to program an ATtiny microcontroller Using your Arduino ISP to program an ATtiny microcontroller Add capacitors and programming connections! Arduino ISP to program an ATtiny microcontroller
Line 122: Line 128:
 With condenser! With condenser!
  
-Select "​ATtiny45 (8 MHz)" in the "​Tools>​ Board" menu \\ Select "​Arduino as ISP" in the menu "​Tools>​ Programmer"​ Arduino as ISP "in the" Tools> Programmer "menu \\ Select "Burn Boot Manager"​ in the "​Tools"​ menu (yes capacitor) \\ Open the sketch you want to load in the ATtinyATtiny \\ Load sketch (yes condenser) \\ Now I connect my sensor to Attiny by adding a buzzer.+Select "​ATtiny45 (8 MHz)" in the "​Tools>​ Board" menu\\ 
 +Select "​Arduino as ISP" in the menu "​Tools>​ Programmer"​ Arduino as ISP "in the" Tools> Programmer "​menu\\ 
 +Select "Burn Boot Manager"​ in the "​Tools"​ menu (yes capacitor)\\ 
 +Open the sketch you want to load in the ATtinyATtiny\\ 
 +Load sketch (yes condenser)\\ 
 +Now I connect my sensor to Attiny by adding a buzzer.
  
 Scheme: Scheme:
Line 130: Line 141:
 Code: Code:
  
-/* \\ CODE for the Fabricademy e-textile sensor swatch \\ first built for the Fabricademy 2017 \\ Hannah Perner-Wilson and Mika Satomi, KOBAKANT \\ */+/*\\ 
 +CODE for the Fabricademy e-textile sensor swatch\\ 
 +first built for the Fabricademy 2017\\ 
 +Hannah Perner-Wilson and Mika Satomi, KOBAKANT\\ 
 +*/
  
-#define sensorPin 3 \\ #define speakerPin 2 \\ #define ledPin 0+#define sensorPin 3\\ 
 +#define speakerPin 2\\ 
 +#define ledPin 0
  
-int sensorValue = 0; \\ int noiseFrequency = 0; \\ int ledBrightness = 0;+int sensorValue = 0;\\ 
 +int noiseFrequency = 0;\\ 
 +int ledBrightness = 0;
  
-void setup() \\ { \\ pinMode(sensorPin,​ INPUT); // use digital pin number here \\ pinMode(speakerPin,​ OUTPUT); \\ pinMode(ledPin,​ OUTPUT); \\ } void loop() \\ { \\ sensorValue = analogRead(sensorPin);​ //use analog pin number here+void setup()\\ 
 +{\\ 
 +pinMode(sensorPin,​ INPUT); // use digital pin number here\\ 
 +pinMode(speakerPin,​ OUTPUT);\\ 
 +pinMode(ledPin,​ OUTPUT);\\ 
 +} void loop()\\ 
 +{\\ 
 +sensorValue = analogRead(sensorPin);​ //use analog pin number here
  
-//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);​ } //+//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);​ } //
  
 ---- ----