Organize files

This commit is contained in:
Axel C
2015-12-01 16:45:35 +01:00
parent 4b5332dbde
commit b0b0d73546
14 changed files with 27 additions and 246 deletions

View File

@@ -0,0 +1,18 @@
What you need for this project
One Arduino Leonardo
http://www.amazon.fr/dp/B00ENSOHJ0
One Relay Board
- 2 Relay board for system withous lamp
http://www.amazon.fr/dp/B00AZEVS5M
- 4 Relays for full system
http://www.amazon.fr/dp/B00AZEVSQG
One 5V USB power
One 12V power
2 12V pumps
2 Water sensors
http://www.amazon.fr/dp/B009DYP2H0
Some BreadBoard cables Fem/Fem and Male/Fem
http://www.amazon.fr/dp/B00ENSOHJ0
http://www.amazon.fr/dp/B00ENSOGWS
Strip LED grow lights

View File

@@ -0,0 +1,9 @@
Source code details
Creat a dedicated folder depending of the setup/course
01-Arduinoponics-Source
- Main source code with all functions and elements
02-Arduinoponics-Basics
- Special very simple version

View File

@@ -1,29 +0,0 @@
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
Most Arduinos have an on-board LED you can control. On the Uno and
Leonardo, it is attached to digital pin 13. If you're unsure what
pin the on-board LED is connected to on your Arduino model, check
the documentation at http://www.arduino.cc
This example code is in the public domain.
modified 8 May 2014
by Scott Fitzgerald
*/
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

View File

@@ -1,42 +0,0 @@
int LEDPin = 8;
long anHour = 1000 * 60 * 60;
long twelveHours = 12 * anHour;
int aSecond = 1000;
/*
* setup() - this function runs once when you turn your Arduino on
* We set the motors pin to be an output (turning the pin high (+5v) or low (ground) (-))
* rather than an input (checking whether a pin is high or low)
*/
void setup()
{
pinMode(LEDPin, OUTPUT);
}
/*
* loop() - this function will start after setup finishes and then repeat
* we call a function called motorOnThenOff()
*/
void loop() // run over and over again
{
ledsOnThenOff();
}
/*
* motorOnThenOff() - turns motor on then off
* (notice this code is identical to the code we used for
* the blinking LED)
*/
void ledsOnThenOff(){
digitalWrite(LEDPin, HIGH);
delay(aSecond);
digitalWrite(LEDPin, LOW);
delay(aSecond);
digitalWrite(LEDPin, HIGH);
delay(anHour);
digitalWrite(LEDPin, LOW);
delay(anHour);
}

View File

@@ -1,73 +0,0 @@
// avr-libc library includes
#include <avr/io.h>
#include <avr/interrupt.h>
#define LEDPIN 8
int daycycle = 14; // number of hours the day lasts (LEDs ON)
int nightcycle = 10; // number of hours the day lasts (LEDs OFF)
long hourseconds = 3600; // number of seconds in an hour
unsigned long daycycleseconds = hourseconds * daycycle;
unsigned long nightcycleseconds = hourseconds * nightcycle;
volatile boolean isday = true;
volatile unsigned long current = 0;
void setup()
{
pinMode(LEDPIN, OUTPUT);
// initialize Timer1
cli(); // disable global interrupts
TCCR1A = 0; // set entire TCCR1A register to 0
TCCR1B = 0; // same for TCCR1B
// set compare match register to desired timer count:
OCR1A = 15624;
// turn on CTC mode:
TCCR1B |= (1 << WGM12);
// Set CS10 and CS12 bits for 1024 prescaler:
TCCR1B |= (1 << CS10);
TCCR1B |= (1 << CS12);
// enable timer compare interrupt:
TIMSK1 |= (1 << OCIE1A);
// enable global interrupts:
sei();
// switches LEDs ON
digitalWrite(LEDPIN, HIGH);
}
void loop()
{
// nothing for now
}
ISR(TIMER1_COMPA_vect)
{
current++;
if(isday){
if(current == daycycleseconds){
apply();
}
}
else{
if(current == nightcycleseconds){
apply();
}
}
}
void apply(){
current = 0;
isday = !isday; // switching day/night
switchLeds();
}
void switchLeds(){
digitalWrite(LEDPIN, !digitalRead(LEDPIN));
}

View File

@@ -1,93 +0,0 @@
/* -----------------------------------------------------------
* | Arduino Experimentation Kit Example Code |
* | CIRC-03 .: Spin Motor Spin :. (Transistor and Motor) |
* -----------------------------------------------------------
*
* The Arduinos pins are great for driving LEDs however if you hook
* up something that requires more power you will quickly break them.
* To control bigger items we need the help of a transistor.
* Here we will use a transistor to control a small toy motor
*
* http://tinyurl.com/d4wht7
*
*/
int motorPin = 9; // define the pin the motor is connected to
// (if you use pin 9,10,11 or 3you can also control speed)
/*
* setup() - this function runs once when you turn your Arduino on
* We set the motors pin to be an output (turning the pin high (+5v) or low (ground) (-))
* rather than an input (checking whether a pin is high or low)
*/
void setup()
{
pinMode(motorPin, OUTPUT);
}
/*
* loop() - this function will start after setup finishes and then repeat
* we call a function called motorOnThenOff()
*/
void loop() // run over and over again
{
motorOnThenOff();
//motorOnThenOffWithSpeed();
//motorAcceleration();
}
/*
* motorOnThenOff() - turns motor on then off
* (notice this code is identical to the code we used for
* the blinking LED)
*/
void motorOnThenOff(){
int onTime = 2500; //the number of milliseconds for the motor to turn on for
int offTime = 1000; //the number of milliseconds for the motor to turn off for
digitalWrite(motorPin, HIGH); // turns the motor On
delay(onTime); // waits for onTime milliseconds
digitalWrite(motorPin, LOW); // turns the motor Off
delay(offTime); // waits for offTime milliseconds
}
/*
* motorOnThenOffWithSpeed() - turns motor on then off but uses speed values as well
* (notice this code is identical to the code we used for
* the blinking LED)
*/
void motorOnThenOffWithSpeed(){
int onSpeed = 200; // a number between 0 (stopped) and 255 (full speed)
int onTime = 2500; //the number of milliseconds for the motor to turn on for
int offSpeed = 50; // a number between 0 (stopped) and 255 (full speed)
int offTime = 1000; //the number of milliseconds for the motor to turn off for
analogWrite(motorPin, onSpeed); // turns the motor On
delay(onTime); // waits for onTime milliseconds
analogWrite(motorPin, offSpeed); // turns the motor Off
delay(offTime); // waits for offTime milliseconds
}
/*
* motorAcceleration() - accelerates the motor to full speed then
* back down to zero
*/
void motorAcceleration(){
int delayTime = 50; //milliseconds between each speed step
//Accelerates the motor
for(int i = 0; i < 256; i++){ //goes through each speed from 0 to 255
analogWrite(motorPin, i); //sets the new speed
delay(delayTime); // waits for delayTime milliseconds
}
//Decelerates the motor
for(int i = 255; i >= 0; i--){ //goes through each speed from 255 to 0
analogWrite(motorPin, i); //sets the new speed
delay(delayTime); // waits for delayTime milliseconds
}
}

Binary file not shown.

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module fritzingVersion="0.9.2b.11.19.8d2d5970658f0bed09c661c9ea9a515b5f40f44c" icon="Custom1.png">
<title>Axel</title>
<instances>
<instance moduleIdRef="OpenMolo 4 Relay Module_bce492ba44c9df49f24a26f0be747041_1" modelIndex="85410446" path="C:/Users/axel/AppData/Roaming/Fritzing/parts/user/OpenMolo 4 Relay Module_bce492ba44c9df49f24a26f0be747041_1.fzp">
<views/>
</instance>
</instances>
</module>

Binary file not shown.