Name, Quantity, Component "U1",1," Arduino Uno R3" "U2",1," Temperature Sensor (TMP36) " "PIEZO2",1," Piezo"

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 9

dobre marcela -un program Arduino monitorizeaza Temperatura mediului Ambiant de um

limiar de 28 C
Name,Quantity,Component
"U1",1," Arduino Uno R3"
"U2",1," Temperature Sensor [TMP36]"
"PIEZO2",1," Piezo"

ame Quantity Component

U1 1 Arduino Uno R3

U2 1 Temperature Sensor [TMP36]

PIEZO2 1 Piezo
create Arduino circuits that riff on the Pomodoro Technique. But as a coding beginner, creating a suitable alternative to a long delay()
can be difficult. This example tracks time with millis() so the Arduino can do other things (read sensors, etc.) during the timed intervals

The Pomodoro Technique is a time management method developed by Francesco Cirillo in


the late 1980s.[1] The technique uses a timer to break down work into intervals, traditionally 25 minutes in length, separated by short breaks. Each interval is
known as a pomodoro, from the Italian word for 'tomato', after the tomato-shaped kitchen timer that Cirillo used as a university student. The technique has
been widely popularized by dozens of apps and websites providing timers and instructions. Closely related to concepts such as timeboxing and iterative and
incremental development used in software design; the method has been adopted in pair programming context. There are six steps in the original technique:
1. Decide on the task to be done.
2. Set the pomodoro timer (traditionally to 25 minutes).[1]

3. Work on the task.

4. End work when the timer rings and put a checkmark on a piece of paper.[5]

5. If you have fewer than four checkmarks, take a short break (3–5 minutes) and then return to step 2; otherwise continue to step 6.

6. After four pomodoros, take a longer break (15–30 minutes), reset your checkmark count to zero, then go to step 1.

For the purposes of the technique, a pomodoro is the interval of time spent working. Regular breaks are taken, aiding assimilation. A short (3–5 minutes) rest
separates consecutive pomodoros. Four pomodoros form a set. A longer (15–30 minute) rest is taken between sets A goal of the technique is to reduce the
impact of internal and external interruptions on focus and flow. A pomodoro is indivisible; when interrupted during a pomodoro, either the other activity must
be recorded and postponed (using the inform – negotiate – schedule – call back strategy[7]) or the pomodoro must be abandoned After task completion in a
pomodoro, any time remaining could be devoted to activities such as:Review and edit the work just completed.review the activities from a learning point of
view: What did I learn? What could I do better or differently? review the list of upcoming tasks for the next planned Pomodoro time blocks, and start reflecting
on or updating those tasks.

/ a simple pomodoro timer


int message = 0;
// the following variables are longs because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
unsigned long TASK_TIME = 10000; // for testing: 10 seconds
unsigned long BREAK_TIME = 5000; // for testing: 5 seconds
//unsigned long TASK_TIME = 2400000; // 40 mins
//unsigned long BREAK_TIME = 600000; // 10 mins
unsigned long taskDelayStart = 0; // the time the delay started
unsigned long breakDelayStart = 0; // the time the delay started
bool taskDelayRunning = false; // true if still waiting for delay to finish
bool breakDelayRunning = false; // true if still waiting for delay to finish
bool taskLightOn = false; // keep track of the lamp state
#define taskLampPin 13
#define breakLampPin 12
#define triggerPin 4
void setup() {
pinMode(triggerPin, INPUT_PULLUP); //set up switch pin with internal pullup resistor
pinMode(taskLampPin, OUTPUT);
digitalWrite(taskLampPin, LOW);
pinMode(breakLampPin, OUTPUT);
digitalWrite(breakLampPin, LOW);
// start the serial connection
Serial.begin(9600);
}
void loop() {
message = digitalRead(triggerPin);
if (message == 0){ //if a task is in progress
if (!taskLightOn && !taskDelayRunning & !breakDelayRunning){ // if the lamp is off and neither
timer has started yet
taskDelayStart = millis(); //start delay
taskDelayRunning = true; //start the task timer
digitalWrite(taskLampPin, HIGH); //turns on the light
taskLightOn = true;
Serial.println("New task: begin work, and continue...");
}
if (taskLightOn && taskDelayRunning && ((millis() - taskDelayStart) >= TASK_TIME)) { // this
code executes when task time is up
taskDelayStart += TASK_TIME; // this prevents drift in the delays
taskDelayRunning = false;
Serial.println("time has elapsed, you've been working hard, take a break");
digitalWrite(breakLampPin, HIGH); //turns on the light
digitalWrite(taskLampPin, LOW); //turns off the light
taskLightOn = false;
breakDelayStart = millis(); //start delay
breakDelayRunning = true; }
if (!taskLightOn && breakDelayRunning && ((millis() - breakDelayStart) >= BREAK_TIME)) { // this
code executes when break time is up
breakDelayStart += BREAK_TIME; // this prevents drift in the delays
breakDelayRunning = false;
Serial.println("break time is over, back to work");
taskDelayRunning = true;
taskDelayStart = millis(); //start delay
digitalWrite(breakLampPin, LOW); //turns on the light
digitalWrite(taskLampPin, HIGH); //turns on the light
taskLightOn = true;
}
}
if (message == 1){ //if task is completed, turn it off
breakDelayRunning = false;
taskDelayRunning = false;
if (taskLightOn){
Serial.println("task complete");
digitalWrite(taskLampPin, LOW); //turns off the light
digitalWrite(breakLampPin, LOW);
taskLightOn = false;
}
Serial.println(" waiting for task");
}
}
How it works
1. Add breakpoints by clicking on the line numbers.
2. Start simulation.
3. Hover over the variables while paused to see their value.

.......................................................................
/*
Adafruit Arduino - Lesson 3. RGB LED https://learn.adafruit.com/adafruit-arduino-lesson-3-rgb-leds/
*/

int redPin = 9;
int greenPin = 10;
int bluePin = 11;

void setup()
{
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}

void loop()
{
setColor(255, 0, 0); // red
delay(1000);
setColor(0, 255, 0); // green
delay(1000);
setColor(0, 0, 255); // blue
delay(1000);
setColor(255, 255, 0); // yellow
delay(1000);
setColor(80, 0, 80); // purple
delay(1000);
setColor(0, 255, 255); // aqua
delay(1000);
}

void setColor(int red, int green, int blue)


{
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}
Theory (PWM) Pulse Width Modulation (or PWM) is a technique for controlling power. We also use it
here to control the brightness of each of the LEDs. The diagram below shows the signal from one of
the PWM pins on the Arduino Roughly every 1/500 of a second, the PWM output will produce a
pulse. The length of this pulse is controlled by the 'analogWrite' function. So 'analogWrite(0)' will not
produce any pulse at all and 'analogWrite(255)' will produce a pulse that lasts all the way until the
next pulse is due, so that the output is actually on all the time. If we specify a value in the
analogWrite that is somewhere in between 0 and 255 then we will produce a pulse. If the output
pulse is only high for 5% of the time then whatever we are driving will only receive 5% of full power.
If however the output is at 5V for 90% of the time then the load will get 90% of the power delivered
to it. We cannot see the LEDs turning on and off at that speed, so to us, it just looks like the
brightness is changing

You might also like