Also mal als erstes... dieses Forum ist der Hammer, nicht nur das Deutsche.
Um alles zu überfliegen braucht man mindestens 4 Wochen und um alles zu lesen vermutlich 4 Jahre.
Also die ersten Gehversuche (vielleicht besser Krabbeln) habe ich mit Arduino Uno und Pro Mini habe ich schon hinter mir, aber .............
Ich versuche wohl eine etwas älte Software in einen Pro Mini Upzuloaden, aber mit 2 Fehlermeldungen.
Gibt es jemanden der mir da helfen könnten um das Projekt ans laufen zubekommen?
/**
* Copyright (c) 2011, Erica S. Kane
*
* This code is based in part on the Lightuino open source project by G. Andrew Stone,
* available at: http://code.google.com/p/arduino-m5451-current-driver/
*
* This software is licensed under the MIT Open License (http://www.opensource.org/licenses/mit-license.php)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
* associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Erica S. Kane
* http://www.thekanes.org/
* http://www.thekanes.org/projects/automated-led-stairs
*/
#include <lightuino3.h>
#include <Ping.h>
// pins 0, 1 used by Serial
const unsigned char bottomPingInputPin = 5;
const unsigned char topPingInputPin = 8;
const unsigned char serDataPin1 = 6;
const unsigned char clockPin = 7;
const unsigned char ledPin = 13; // Arduino LED connected to digital pin 13
// timing for light sequences (ms)
const long lightSpacing = 250;
const long lightHold = 10000;
const long pingReadDelay = 100;
Ping bottomPing = Ping(bottomPingInputPin, 0, 0);
Ping topPing = Ping(topPingInputPin, 0, 0);
// Distance triggers for Ping
const float minBottomIn = 30.0f;
const float minTopIn = minBottomIn;
// LightuinoSink(uint8_t clockPin=7,uint8_t serDataPin1=6,uint8_t serDataPin2=5,uint8_t brightPin=4);
LightuinoSink sinks(clockPin, serDataPin1, 100, 4);
boolean bClimbStarted = false;
boolean bDescentStarted = false;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(serDataPin1, OUTPUT);
pinMode(clockPin, OUTPUT);
digitalWrite(ledPin, LOW);
delay(1000);
Serial.print("Flags: ");
Serial.println(sinks.flags);
sinks.set(0,0,0);
}
void loop() {
// see if anyone has triggered the sensor on the bottom step
checkBottomSensor();
if(bClimbStarted) {
bClimbStarted = false;
bDescentStarted = false;
Serial.println("Firing climbing sequence.");
climbLightSequence();
}
else {
// see if anyone has triggered the sensor on the top step
checkTopSensor();
if(bDescentStarted) {
bClimbStarted = false;
bDescentStarted = false;
Serial.println("Firing descent sequence.");
descentLightSequence();
}
}
delay(pingReadDelay);
}
/**
* Looks to see if anyone has tripped the bottom sensor. If so, set a flag.
*/
void checkBottomSensor() {
bottomPing.fire();
/**
* If the PING cannot "see" anything, the fire method can take a while
* as it waits for the echo. For continuous recording, it's best to have
* something outside the minimum so that the ultrasonic wave bounces back
* quickly.
*/
if((bottomPing.inches() < minBottomIn) && (bottomPing.inches() > 0)) {
Serial.println("Bottom sensor tripped.");
bClimbStarted = true;
}
}
/*
* Looks to see if anyone has tripped the bottom sensor. If so, set a flag.
*/
void checkTopSensor() {
topPing.fire();
if((topPing.inches() < minTopIn) && (topPing.inches() > 0)) {
Serial.println("Top sensor tripped.");
bDescentStarted = true;
}
}
/**
* Light pattern that fires when someone starts climbing the steps
*/
void climbLightSequence() {
// You could put code in here to use other sequences of your design
standardClimbSequence();
}
void standardClimbSequence() {
Serial.println("climbLightSequence started.");
byte ledState[9];
for (int j=0;j<9;j++) {
ledState[j] = B00000000;
}
/**
* ledState[1] controls pins 3 through 10 on the M4541.
* ledState[2] controls pin 2 and ...?
* ledState[0] controls pin 11 and ... ?
*/
ledState[1] = B00000000;
ledState[2] = B00000000;
Serial.println("Turn on pin 11."); // bottom
ledState[0] = B10000000;
sinks.set(ledState);
delay(lightSpacing);
Serial.println(" Turn on LEDs from pin 10 to pin 3 in sequence");
// Each bit (1 or 0) in this array corresponds to one LED light
for (int j=0; j < 9; j++) {
ledState[1] = (ledState[1] << 1) + 1;
Serial.print("ledState[1] = ");
Serial.println(ledState[1], BYTE);
// Now send it to the chips.
sinks.set(ledState);
delay(lightSpacing);
}
Serial.println("Turn on pin 2.");
ledState[2] = B00000001;
sinks.set(ledState);
delay(lightSpacing);
// Keep them lit for a while
delay(lightHold);
// Serial.println(" Turn them all off!");
// sinks.set(0,0,0);
// Now reverse the sequence
Serial.println("Turn off pin 11."); // bottom
ledState[0] = B00000000;
sinks.set(ledState);
delay(lightSpacing);
Serial.println(" Turn off LEDs from pin 10 to pin 3 in sequence");
// Each bit (1 or 0) in this array corresponds to one LED light
for (int j=0; j < 9; j++) {
ledState[1] = ledState[1] << 1;
Serial.print("ledState[1] = ");
Serial.println(ledState[1], BYTE);
// Now send it to the chips.
sinks.set(ledState);
delay(lightSpacing);
}
Serial.println("Turn off pin 2."); // top
ledState[2] = B00000000;
sinks.set(ledState);
delay(lightSpacing);
}
/**
* Light pattern that fires when someone starts going down the steps
*/
void descentLightSequence() {
// You could put code in here to use other sequences of your design
standardDescentSequence();
}
void standardDescentSequence() {
Serial.println("descentLightSequence started.");
byte ledState[9];
for (int j=0;j<9;j++) {
ledState[j] = B00000000;
}
/**
* ledState[1] controls pins 3 through 10 on the M4541.
* ledState[2] controls pin 2 and ...?
* ledState[0] controls pin 11 and ... ?
*/
ledState[1] = B00000000;
ledState[2] = B00000000;
Serial.println("Turn on pin 2.");
ledState[2] = B00000001;
sinks.set(ledState);
delay(lightSpacing);
Serial.println(" Turn on LEDs from pin 3 to pin 10 in sequence");
// Each bit (1 or 0) in this array corresponds to one LED light
for (int j=0; j < 9; j++) {
ledState[1] = (ledState[1] >> 1) + 128;
Serial.print("ledState[1] = ");
Serial.println(ledState[1], BYTE);
// Now send it to the chips.
sinks.set(ledState);
delay(lightSpacing);
}
Serial.println("Turn on pin 11.");
ledState[0] = B10000000;
sinks.set(ledState);
// Keep them lit for a while
delay(lightHold);
// Serial.println(" Turn them all off!");
// sinks.set(0,0,0);
// Now reverse the sequence
Serial.println("Turn off pin 2.");
ledState[2] = B00000000;
sinks.set(ledState);
Serial.println(" Turn off LEDs from pin 3 to pin 10 in sequence");
// Each bit (1 or 0) in this array corresponds to one LED light
for (int j=0; j < 9; j++) {
ledState[1] = ledState[1] >> 1;
Serial.print("ledState[1] = ");
Serial.println(ledState[1], BYTE);
// Now send it to the chips.
sinks.set(ledState);
delay(lightSpacing);
}
Serial.println("Turn off pin 11.");
ledState[0] = B00000000;
sinks.set(ledState);
delay(lightSpacing);
}