Browse Source

Merge branch 'feature/git_merge_fix' into develop

develop
Carmine De Rosa 6 years ago
parent
commit
fb5c9dadb7
  1. 15
      README.md
  2. 97
      arduino/arduino.ino
  3. 6
      ephimera/ephimera.pde
  4. 0
      ephimera/frames.pde
  5. 0
      ephimera/history/shot_20190927_175024.gif
  6. 0
      ephimera/history/shot_20190927_175028.gif
  7. 0
      ephimera/percentage.pde
  8. 1
      ephimera/serial.pde
  9. 0
      script/ephimera.sh

15
README.md

@ -1 +1,14 @@
ephimera
## Ephimera
### Keyboard commands
```
ESC - Exti from the program ans shutdown
```
```
U - Unload liquid from the pumps
```
```
1-8 - Load liquid in single pumps (from 1 to 8)
```

97
arduino/arduino.ino

@ -7,17 +7,23 @@ Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
#define SERVOMAX 390 // this is the 'maximum' pulse length count (out of 4096)
#define TIMER 200
#define SERVODIVIDER 5
#define STRIP 10
const char HEADER = 'H';
const char HEADER = 'H';
const char A_TAG = 'M';
const char B_TAG = 'X';
const char C_TAG = 'U';
const char F_TAG = 'F';
const int TOTAL_BYTES = 10 ; // the total bytes in a message
int atomPins[] = {2,3,4,5,6,7,8,9};
int currentValue = 0;
int values[] = {0,0,0,0,0,0,0,0};
int cycle = 0;
boolean fadeDirection = 0; // 0 grow
byte fadeStatus = 0;
void setup() {
Serial.begin(9600);
@ -27,8 +33,8 @@ void setup() {
pwm.setPWM(i, 0, ((SERVOMAX-SERVOMIN)/2)+SERVOMIN);
}
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
pinMode(STRIP, OUTPUT);
fadeIn();
pwm.begin();
pwm.setPWMFreq(60); // Analog servos run at ~60 Hz updates
@ -57,44 +63,56 @@ void loop() {
values[i] = 0;
}
if(Serial.available() >= TOTAL_BYTES) {
if( Serial.read() == HEADER) {
char tag = Serial.read();
if(tag == F_TAG) {
fadeOut();
}
if(tag == A_TAG || tag == B_TAG) {
for(int i=0; i<8; i++) {
values[i] = Serial.read();
}
}
for(int i=0; i<8; i++) {
if(tag == A_TAG) {
pwm.setPWM(i, 0, SERVOMAX+50);
delay(100*SERVODIVIDER);
pwm.setPWM(i, 0, SERVOMAX-50);
delay(100*SERVODIVIDER);
}
pwm.setPWM(i, 0, SERVOMIN);
delay(values[i]*SERVODIVIDER);
pwm.setPWM(i, 0, ((SERVOMAX-SERVOMIN)/2)+SERVOMIN);
}
if(tag == C_TAG) {
for(int i=0; i<8; i++) {
pwm.setPWM(i, 0, SERVOMAX+50);
delay(100*SERVODIVIDER);
pwm.setPWM(i, 0, ((SERVOMAX-SERVOMIN)/2)+SERVOMIN);
}
} else {
for(int i=0; i<8; i++) {
if(tag == A_TAG) {
pwm.setPWM(i, 0, SERVOMAX+50);
delay(100*SERVODIVIDER);
pwm.setPWM(i, 0, SERVOMAX-50);
delay(100*SERVODIVIDER);
}
pwm.setPWM(i, 0, SERVOMIN);
delay(values[i]*SERVODIVIDER);
pwm.setPWM(i, 0, ((SERVOMAX-SERVOMIN)/2)+SERVOMIN);
Serial.print(values[i]);
Serial.print(" ");
if(values[i]>0) {
values[i]--;
digitalWrite(atomPins[i], HIGH);
if(values[i]==0) {
cycle++;
digitalWrite(atomPins[i], LOW);
}
}
}
/*
for(int i=0; i<8; i++) {
pwm.setPWM(i, 0, SERVOMIN);
delay(values[i]*SERVODIVIDER);
pwm.setPWM(i, 0, ((SERVOMAX-SERVOMIN)/2)+SERVOMIN);
}
*/
if(tag == A_TAG) {
while(cycle < 8) {
cycle = 0;
@ -111,12 +129,43 @@ void loop() {
} else {
cycle++;
}
for(int f=0;f<4;f++){
fadeGradient();
delay(TIMER/(8*4));
}
}
Serial.println("");
delay(TIMER);
}
fadeIn();
}
}
}
}
}
}
void fadeIn() {
for(int i=0; i<255; i++) {
analogWrite(STRIP, i);
delay(10);
}
}
void fadeOut() {
for(int i=255; i>0; i--) {
analogWrite(STRIP, i);
delay(10);
}
}
void fadeGradient() {
if(fadeDirection == 0) {fadeStatus++;}
if(fadeDirection == 1) {fadeStatus--;}
if(fadeStatus == 0) {fadeDirection = 0;}
if(fadeStatus == 255) {fadeDirection = 1;}
analogWrite(STRIP, fadeStatus);
}

6
ephimera/ephimera.pde

@ -43,6 +43,7 @@ void draw() {
if (GPIO.digitalRead(4) == GPIO.LOW && takePicture == true){
takePicture = false;
sendMessage(F_TAG, colorByteValues);
delay(4000);
video.pause();
makePicture();
@ -57,7 +58,6 @@ void draw() {
}
void keyPressed() {
if (key == 'S' || key == 's') {
video.pause();
makePicture();
@ -68,13 +68,11 @@ void keyPressed() {
if (key == 'G' || key == 'g') {
video.start();
}
if (key == 'U' || key == 'u') {
sendMessage(C_TAG, colorByteValues);
}
if (key == '1' || key == '2' || key == '3' || key == '4' || key == '5' || key == '6' || key == '7' || key == '8') {
for(int i = 0; i<colorsN; i++) {
for(int i=0; i<colorsN; i++) {
colorByteValues[i] = (int(key)-49) == i ? byte(100) : 0;
print(colorByteValues[i] + "\t");
}

0
ephimera/frames.pde

0
ephimera/history/shot_20190927_175024.gif

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

0
ephimera/history/shot_20190927_175028.gif

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

0
ephimera/percentage.pde

1
ephimera/serial.pde

@ -2,6 +2,7 @@ public static final char HEADER = 'H';
public static final char A_TAG = 'M';
public static final char B_TAG = 'X';
public static final char C_TAG = 'U';
public static final char F_TAG = 'F';
void ephSerial() {

0
script/ephimera.sh

Loading…
Cancel
Save