|
@@ -2,6 +2,8 @@
|
|
|
#include <Servo.h>
|
|
#include <Servo.h>
|
|
|
Servo myservo;
|
|
Servo myservo;
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
#define Port7 7 //for TFT_ILI9163C_CSpin 7
|
|
#define Port7 7 //for TFT_ILI9163C_CSpin 7
|
|
|
#define Port8 8 //for TFT_ILI9163C_DCpin 8
|
|
#define Port8 8 //for TFT_ILI9163C_DCpin 8
|
|
@@ -37,7 +39,6 @@ Servo myservo;
|
|
|
#include "automation_driven.submodule.struct.write_neuron.h"
|
|
#include "automation_driven.submodule.struct.write_neuron.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
#if defined(HAS_LCD1602_I2C)
|
|
#if defined(HAS_LCD1602_I2C)
|
|
|
#include <LiquidCrystal_I2C.h>
|
|
#include <LiquidCrystal_I2C.h>
|
|
|
LiquidCrystal_I2C lcd(0x27,LCD1602_DISPLAY_PHYSICAL_X_CHARS_A,LCD1602_DISPLAY_PHYSICAL_Y_CHARS_A);
|
|
LiquidCrystal_I2C lcd(0x27,LCD1602_DISPLAY_PHYSICAL_X_CHARS_A,LCD1602_DISPLAY_PHYSICAL_Y_CHARS_A);
|
|
@@ -69,6 +70,36 @@ Servo myservo;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+#if defined(HAS_BH1750)
|
|
|
|
|
+ #include <Wire.h> //BH1750 IIC Mode
|
|
|
|
|
+ #include <math.h>
|
|
|
|
|
+ int BH1750address = 0x23; //setting i2c address
|
|
|
|
|
+ byte BH1750_buff[2];
|
|
|
|
|
+ bool if_BH1750_Init = 0 ;
|
|
|
|
|
+ void BH1750_Init(int address)
|
|
|
|
|
+ {
|
|
|
|
|
+ Wire.beginTransmission(address);
|
|
|
|
|
+ Wire.write(0x10);//1lx reolution 120ms
|
|
|
|
|
+ Wire.endTransmission();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ int BH1750_Read(int address) //
|
|
|
|
|
+ {
|
|
|
|
|
+ int i=0;
|
|
|
|
|
+ Wire.beginTransmission(address);
|
|
|
|
|
+ Wire.requestFrom(address, 2);
|
|
|
|
|
+ while(Wire.available()) //
|
|
|
|
|
+ {
|
|
|
|
|
+ BH1750_buff[i] = Wire.read(); // receive one byte
|
|
|
|
|
+ i++;
|
|
|
|
|
+ }
|
|
|
|
|
+ Wire.endTransmission();
|
|
|
|
|
+ return i;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -112,9 +143,16 @@ Servo myservo;
|
|
|
//#include "config_Slave_Ports_LOCAL_init.h"
|
|
//#include "config_Slave_Ports_LOCAL_init.h"
|
|
|
#include "automation_driven.submodule.struct.write_neuron_override.h"
|
|
#include "automation_driven.submodule.struct.write_neuron_override.h"
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
#include "neuron-conf.h"
|
|
#include "neuron-conf.h"
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
#include "config_Slave_Ports_LOCAL_neuron_config.h"
|
|
#include "config_Slave_Ports_LOCAL_neuron_config.h"
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
#include "neuron_Input_func.h"
|
|
#include "neuron_Input_func.h"
|
|
|
#include "neuron_Stress_func.h"
|
|
#include "neuron_Stress_func.h"
|
|
|
#include "neuron_Attract_func.h"
|
|
#include "neuron_Attract_func.h"
|
|
@@ -145,18 +183,27 @@ bool neuron_print_ROTTARY_Coordinate_Y_SHIFT_flag = 0 ;
|
|
|
#endif
|
|
#endif
|
|
|
// bool if_show_p0_neuron_title = 0 ;
|
|
// bool if_show_p0_neuron_title = 0 ;
|
|
|
#include "TASK_TYPE_T_Get_Ports_Status_INPUT_A___.h"
|
|
#include "TASK_TYPE_T_Get_Ports_Status_INPUT_A___.h"
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
#include "_Slave_Ports_Status_func_add_lite.h"
|
|
#include "_Slave_Ports_Status_func_add_lite.h"
|
|
|
|
|
|
|
|
|
|
+
|
|
|
#if Active_ControllerID == 0x14
|
|
#if Active_ControllerID == 0x14
|
|
|
#include "0x14/config_Slave_Ports_LOCAL_0x14_init.h"
|
|
#include "0x14/config_Slave_Ports_LOCAL_0x14_init.h"
|
|
|
|
|
+#elif Active_ControllerID == 0x35
|
|
|
|
|
+ #include "0x35/config_Slave_Ports_neuron_LOCAL_0x35_init.h"
|
|
|
|
|
+
|
|
|
#elif Active_ControllerID == 0x38
|
|
#elif Active_ControllerID == 0x38
|
|
|
#include "0x38/config_Slave_Ports_LOCAL_0x38_init.h"
|
|
#include "0x38/config_Slave_Ports_LOCAL_0x38_init.h"
|
|
|
|
|
+
|
|
|
#else
|
|
#else
|
|
|
#error not set correct Active_ControllerID
|
|
#error not set correct Active_ControllerID
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
#if defined(HAS_W5IOKeypad)
|
|
#if defined(HAS_W5IOKeypad)
|
|
|
W5IOKeypad Keypad( W5IOKeypad_PIN_GND, W5IOKeypad_PIN_IO1, W5IOKeypad_PIN_IO2, W5IOKeypad_PIN_IO3, W5IOKeypad_PIN_IO4, W5IOKeypad_PIN_IO5 );
|
|
W5IOKeypad Keypad( W5IOKeypad_PIN_GND, W5IOKeypad_PIN_IO1, W5IOKeypad_PIN_IO2, W5IOKeypad_PIN_IO3, W5IOKeypad_PIN_IO4, W5IOKeypad_PIN_IO5 );
|
|
|
int IOKey = 0;
|
|
int IOKey = 0;
|
|
@@ -224,10 +271,10 @@ void action_button_input( ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
void setup() { //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
|
|
void setup() { //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
|
|
|
Serial.begin(115200);
|
|
Serial.begin(115200);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
lcd.init(); // Print a message to the LCD.
|
|
lcd.init(); // Print a message to the LCD.
|
|
|
lcd.backlight();
|
|
lcd.backlight();
|
|
|
lcd.setCursor(0,0);
|
|
lcd.setCursor(0,0);
|
|
@@ -278,18 +325,36 @@ void setup() { //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
|
|
|
#if defined(HAS_ADKeyboard)
|
|
#if defined(HAS_ADKeyboard)
|
|
|
// pinMode(ADKeyboard_PIN, INPUT_PULLUP) ;
|
|
// pinMode(ADKeyboard_PIN, INPUT_PULLUP) ;
|
|
|
#endif
|
|
#endif
|
|
|
|
|
+
|
|
|
|
|
+ #if defined(HAS_BH1750)
|
|
|
|
|
+ Wire.begin();
|
|
|
|
|
+ #endif
|
|
|
|
|
+
|
|
|
|
|
+ // pinMode(11, OUTPUT);
|
|
|
|
|
+ // pinMode(13, OUTPUT);
|
|
|
|
|
+ // pinMode(3, OUTPUT);
|
|
|
|
|
+ // pinMode(5, OUTPUT);
|
|
|
|
|
+ // pinMode(A7, OUTPUT);
|
|
|
|
|
+ // pinMode(13, OUTPUT);
|
|
|
|
|
+ // digitalWrite(13,LOW);
|
|
|
|
|
+ // pinMode(A6, INPUT) ;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
void loop() {
|
|
void loop() {
|
|
|
-
|
|
|
|
|
- // Serial.println(F("L"));
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if(NEURON_TO_PORT_A_INDEX_NEXT > NEURON_TO_PORT_A_LIMIT) { SPFTFT2(limit,error,-321); SPFTFT2(value,error, NEURON_TO_PORT_A_INDEX_NEXT - NEURON_TO_PORT_A_LIMIT ) ;}
|
|
|
|
|
+ if(PORT_to_NEURON_A_INDEX_NEXT > PORT_to_NEURON_A_LIMIT) { SPFTFT2(limit,error,-322); SPFTFT2(value,error, PORT_to_NEURON_A_INDEX_NEXT - PORT_to_NEURON_A_LIMIT ) ; }
|
|
|
|
|
+ // digitalWrite(31,HIGH);
|
|
|
|
|
+ // digitalWrite(33,HIGH);
|
|
|
|
|
+ //SPFTFT2(level,debug,analogRead(A6));
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
if(triggerCount != triggerCountOld) {
|
|
if(triggerCount != triggerCountOld) {
|
|
|
|
|
|
|
|
|
|
+
|
|
|
SPFTFT2(rottary,trigger,triggerCount);
|
|
SPFTFT2(rottary,trigger,triggerCount);
|
|
|
|
|
|
|
|
if(triggerCountOld_t < millis()) {
|
|
if(triggerCountOld_t < millis()) {
|
|
@@ -314,22 +379,25 @@ void setup() { //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
|
|
|
|
|
|
|
|
// if(if_show_p0_neuron_title == 0) show_p0_neuron_title() ;
|
|
// if(if_show_p0_neuron_title == 0) show_p0_neuron_title() ;
|
|
|
// Serial.print(F("R"));
|
|
// Serial.print(F("R"));
|
|
|
-
|
|
|
|
|
#if defined(HAS_HCSR04)
|
|
#if defined(HAS_HCSR04)
|
|
|
HCSR04_input();
|
|
HCSR04_input();
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
neuron_PORT_to_NEURON();
|
|
neuron_PORT_to_NEURON();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
neuron_Resting_Potenial_input();
|
|
neuron_Resting_Potenial_input();
|
|
|
neuron_Resting_Potenial();
|
|
neuron_Resting_Potenial();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
// Serial.print(F("C"));
|
|
// Serial.print(F("C"));
|
|
|
Simulated_potential_show_lcd();
|
|
Simulated_potential_show_lcd();
|
|
|
|
|
+
|
|
|
// Serial.print(F("P"));
|
|
// Serial.print(F("P"));
|
|
|
#if defined(HAS_TFT_HX8357) || defined(HAS_TFT_ILI9163C)
|
|
#if defined(HAS_TFT_HX8357) || defined(HAS_TFT_ILI9163C)
|
|
|
neuron_print();
|
|
neuron_print();
|
|
|
#endif
|
|
#endif
|
|
|
TASK_TYPE_T_Get_Ports_Status_INPUT_A___LOOP();
|
|
TASK_TYPE_T_Get_Ports_Status_INPUT_A___LOOP();
|
|
|
-
|
|
|
|
|
#if defined(HAS_W5IOKeypad)
|
|
#if defined(HAS_W5IOKeypad)
|
|
|
// Serial.print(F("K"));
|
|
// Serial.print(F("K"));
|
|
|
IOKey=Keypad.ReadButtons();
|
|
IOKey=Keypad.ReadButtons();
|
|
@@ -366,5 +434,4 @@ void setup() { //REMEMBER NOT INITIALIZE ANY VARIABLES OR ARRAYS
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
|
- // delay(100);
|
|
|
|
|
}
|
|
}
|