Testing Tool for Board written.

This commit is contained in:
2015-02-16 17:50:58 +01:00
parent 4c9a8c8230
commit 6e4afd0a2d
25 changed files with 3273 additions and 10 deletions

115
tools/testing/config.h Normal file
View File

@@ -0,0 +1,115 @@
/**
* @file config.h
* Project axefx.de MIDI Borad TWO
* @brief Config-File for Testing-Tool.
* Here you have to modify your used Arduino-Pins
* and if you like to use the LCD-Display.
* @version 1.0.0
* @author Bastian Buehrig
* @date 15/02/15
* license GPL axefx.de - 2015
*/
#ifndef Config_h
#define Config_h
// Include Configuration
// If you don't want a feature, switch it of with a '0'
#define USE_LCD 1
// ============== Pin Configuration ==============
//
// LCD-Pin Definitions
#if USE_LCD==1
#define LCD_D7 44
#define LCD_D6 45
#define LCD_D5 46
#define LCD_D4 47
#define LCD_E 48
#define LCD_RS 49
#endif
// LED und Switch Pins
#define SWT_MAX 23 // How many switches (and LEDs) does your MIDI-Board have?
#define SWT01 2
#define LED01 3
#define SWT02 4
#define LED02 5
#define SWT03 6
#define LED03 7
#define SWT04 8
#define LED04 9
#define SWT05 10
#define LED05 11
#define SWT06 12
#define LED06 13
#define SWT07 22
#define LED07 24
#define SWT08 26
#define LED08 28
#define SWT09 30
#define LED09 32
#define SWT10 34
#define LED10 36
#define SWT11 38
#define LED11 40
#define SWT12 23
#define LED12 25
#define SWT13 27
#define LED13 29
#define SWT14 31
#define LED14 33
#define SWT15 35
#define LED15 37
#define SWT16 39
#define LED16 41
#define SWT17 42
#define LED17 43
#define SWT18 A8
#define LED18 A9
#define SWT19 A10
#define LED19 A11
#define SWT20 A12
#define LED20 A13
#define SWT21 A14
#define LED21 A15
#define SWT22 A6
#define LED22 A7
#define SWT23 14
#define LED23 15
#define SWT24 16
#define LED24 17
#define SWT25 20
#define LED25 21
#define SWT26 50
#define LED26 51
#define SWT27 52
#define LED27 99
#define SWT28 53
#define LED28 99
// Expression-Pedal Pins
#define EXP01 A0
#define EXP02 A1
// Layer-LEDs
#define LAY_LED01 A2
#define LAY_LED02 A3
#define LAY_LED03 A4
#define LAY_LED04 A5
#endif

View File

@@ -1,24 +1,105 @@
/**
* @file testing.ino
* Project axefx.de MIDI Borad TWO
* @brief Testing-Tool for test all your switches, leds and
* LCD-Display (if you'll use one).
* It will turn on and of all your LEDs. After it,
* you can test your switches to light up the LEDs manually.
* Additionally you can see some Informations on your LCD-Display
* and it writes the same text in the serial monitor.
* @version 1.0.0
* @author Bastian Buehrig
* @date 16/02/15
* license GPL axefx.de - 2015
*/
#include "config.h"
// LCD-Display includes
#if USE_LCD==1
#include <LiquidCrystal.h>
LiquidCrystal lcd(LCD_RS, LCD_E, LCD_D4, LCD_D5, LCD_D6, LCD_D7);
#endif
// Pin-Definitions - you have to modify this list, if you like to use more or less than 23 Switches!
byte swt_pins[SWT_MAX] = { SWT01, SWT02, SWT03, SWT04, SWT05, SWT06, SWT07, SWT08, SWT09, SWT10,
SWT11, SWT12, SWT13, SWT14, SWT15, SWT16, SWT17, SWT18, SWT19, SWT20,
SWT21, SWT22, SWT23 }; // SWT24, SWT25, SWT26, SWT27, SWT28
byte led_pins[SWT_MAX] = { LED01, LED02, LED03, LED04, LED05, LED06, LED07, LED08, LED09, LED10,
LED11, LED12, LED13, LED14, LED15, LED16, LED17, LED18, LED19, LED20,
LED21, LED22, LED23 }; // LED24, LED25, LED26, LED27, LED28
/**
* Function to initialize the pin-modes and
* switch on and off shortly all LEDs.
*
*/
void setup() {
// Init Serial Monitor for Informations...
Serial.begin(9600);
for(int i=22; i <= 36; i=i+2) {
pinMode(i, INPUT);
pinMode(i+1, OUTPUT);
#if USE_LCD==1
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
#endif
printInfo("Initialisation...");
// Setting Pin-Modes
for(byte i=0; i < SWT_MAX; i=i+1) {
pinMode(swt_pins[i], INPUT_PULLUP);
pinMode(led_pins[i], OUTPUT);
}
for(int i=22; i <= 36; i=i+2) {
digitalWrite(i+1, HIGH); // turn the LED on (HIGH is the voltage level)
// Turn LED on, then off
for(byte i=0; i < SWT_MAX; i=i+1) {
printInfo("LED " + String(i+1));
digitalWrite(led_pins[i], HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(i+1, LOW); // turn the LED off by making the voltage LOW
digitalWrite(led_pins[i], LOW); // turn the LED off by making the voltage LOW
delay(100);
}
}
/**
* Main Loop-Function. Read out the Switch-States and
* if you press a switch, the Switch LED will be switch on
* during you are pressing the switch.
*
*/
void loop() {
for(int i=22; i <= 36; i=i+2) {
byte actState = digitalRead(i);
digitalWrite(i+1, actState);
for(byte i=0; i < SWT_MAX; i=i+1) {
byte actState = digitalRead(swt_pins[i]);
digitalWrite(led_pins[i], !actState);
if(!actState) {
printInfo("Switch " + String(i+1) + " pressed!");
}
}
}
/**
* Function to print out informations to Serial-Monitor and LCD-Dsiplay
*
* @param infoText Text to print out
*/
void printInfo(String infoText) {
Serial.println(infoText);
#if USE_LCD==1
lcd.print(infoText);
#endif
}