
Shiri Sagron - Digital material culture
Electronics
1 Experience
const int red_led_pin_Shiri=3;
const int yellow_led_pin_Shiri=2;
const int green_led_pin_Shiri=8;
void setup() {
//put your setup code here, to run once
pinMode (red_led_pin_Shiri, OUTPUT);
pinMode (yellow_led_pin_Shiri, OUTPUT);
pinMode (green_led_pin_Shiri, OUTPUT);
}
void loop() {
//put your main code here, to run repeatedly
digitalWrite(red_led_pin_Shiri, HIGH);
delay(300);
//wait 300milsecend
digitalWrite(yellow_led_pin_Shiri, HIGH);
delay(300);
//wait 300milsecend
digitalWrite(green_led_pin_Shiri, HIGH);
delay(300);
//wait 300milsecend
digitalWrite(red_led_pin_Shiri, LOW);
digitalWrite(yellow_led_pin_Shiri, LOW);
digitalWrite(green_led_pin_Shiri, LOW);
// put your main code here, to run repeatedly
digitalWrite(red_led_pin_Shiri,HIGH);
}


2 Experience
// The leds are coonected to pins 3,4,5:
const int Red_led=3;
const int yellow_led=4;
const int green_led=5;
//The potetiometer is coonected to pin A0;
const int Poten_pin=A0;
//Define variiables to contain data;
int poten_val;
int Mkzav;
void setup() {
//put your setup code here, to run once;
Serial.begin(9600);
pinMode(Red_led, OUTPUT);
pinMode(yellow_led, OUTPUT);
pinMode(green_led, OUTPUT);
}
void loop(){
//put your main code here, to run repeatedly;
poten_val = analogRead(Poten_pin);
Serial.println(poten_val);
Mkzav = map(poten_val , 100 , 700, 50,1000);
//Turn on Red
digitalWrite(Red_led, HIGH);
digitalWrite(yellow_led, LOW);
digitalWrite(green_led, LOW);
delay(Mkzav);
//Turn on yellow
digitalWrite(Red_led, LOW);
digitalWrite(yellow_led,HIGH);
digitalWrite(green_led, LOW);
delay(Mkzav);
//Turn on green
digitalWrite(Red_led, LOW);
digitalWrite(yellow_led,LOW);
digitalWrite(green_led, HIGH);
delay(Mkzav);
}


3 Experience
const int buzz_pin= 3;
const int dtimeL=1000;
const int dtimeS=dtimeL/2;
const int G =392;
const int F =349;
const int E = 329;
const int D =293;
const int C = 261;
const int B = 246;
const int A = 220;
void setup(){
}
void loop(){
tone(buzz_pin, G ,500);
delay(dtimeS);
tone(buzz_pin, E ,500);
delay(dtimeS);
tone(buzz_pin, E ,500);
delay(dtimeL);
tone(buzz_pin, F,500);
delay(dtimeS);
tone(buzz_pin, D,500);
delay(dtimeS);
tone(buzz_pin, F,500);
delay(dtimeL);
tone(buzz_pin, C,500);
delay(dtimeS);
tone(buzz_pin, D,500);
delay(dtimeS);
tone(buzz_pin, E,500);
delay(dtimeS);
tone(buzz_pin, F,500);
delay(dtimeS);
tone(buzz_pin, G,500);
delay(dtimeS);
tone(buzz_pin, G,500);
delay(dtimeL);
noTone(buzz_pin);
}

4 Experience
#include <Servo.h>
Servo shiriStepper;
void setup(){
shiriStepper.attach (3);
}
void loop(){
shiriStepper.write(10);
delay(1000);
shiriStepper.write(150);
delay(1000);
}


5 Experience
Finel Experience
const int sensorPin=A0;
const int redPin= 6;
const int greenPin = 5;
const int bluePin = 3;
​
void setup() {
// put your setup code here, to run once:
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
pinMode(sensorPin, INPUT);
Serial.begin(9600);// initialize serial communications at 9600 bps:
}
void loop() {
// put your main code here, to run repeatedly:
int sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
if (sensorValue <500 ){
setColor(255, 0, 0); // Red Color
delay(1000);
}
else if (sensorValue < 550 ){
setColor(0, 255, 0); // Green Color
delay(1000);
}
else if (sensorValue > 600 ){
setColor(0, 0, 255); // Blue Color
delay(1000);
}
else if (sensorValue > 650 ){
setColor(255, 255, 255); // White Color
delay(1000);
}
else if (sensorValue > 650 || sensorValue < 800 ){
setColor(170, 0, 255); // Purple Color
delay(1000);
}
void setColor(int redValue, int greenValue, int blueValue) {
analogWrite(redPin, redValue);
analogWrite(greenPin, greenValue);
analogWrite(bluePin, blueValue);
}
It is a device that measures sound volume according to the sound volume and a lamp changes its color.
