/* P5_Automation_can-dev */ #define _ControllerID 0x101 #define _Slave1_ID 0x103 #define Active_ControllerID _ControllerID //#define Active_ControllerID _Slave1_ID #include "Slave_Ports_Status.h" Slave_Ports_Status Slave_Ports_Status_C; //#include "Slave_Ports_QUEUE.h" //#include "_Slave_Ports_queue_task_type_LIST.h" //#include "_Slave_Ports_Protocol.h" //BEGIN CAN /* #include #include long unsigned int CANrxId; unsigned char CANlen = 0; unsigned char CANrxBuf[8]; const int CAN_CSpin = 53 , CAN_INTpin = 10 ; MCP_CAN CAN0(CAN_CSpin); // Set CS to pin 10 //EOF CAN */ //REMOTE PORTS DEFINITIONS // #include "_Slave_Ports.h" /* #if defined(HAS_ROTTARY_SW) #include "_ROTTARY_SW.h" #endif // include the library code //EOF BEGIN 1602 #include "_PCINT.h" #include "_PCINT_loop.h" */ int Slave_Ports_Status_C_ports_defined = 0; void setup() { Serial.begin(57600); // Slave_Ports_QUEUE Slave_Ports_QUEUE_C; //#include "_Slave_Ports_LOCAL_LIST.h" /*AAA #if defined(HAS_LCD1602) lcd.begin(16, 2); #endif */ //Slave_Ports_Status_T _add[] = { 1, Active_ControllerID, 0x01, 0x00, 1, 0x01, 0x01, 0x01 }; Serial.println("UUWWW adding ports"); //todo PCINT service //#include "_PCINT_setup.h" /* #if defined(HAS_ROTTARY_SW) #include "_ROTTARY_SW_setup.h" #endif */ Serial.println("CCCAA"); /* if(CAN0.begin(MCP_ANY, CAN_500KBPS, MCP_16MHZ) == CAN_OK) { Serial.println("#303 MCP2515 Init Okay"); CAN0.setMode(MCP_NORMAL); // Change to normal mode to allow messages to be transmitted pinMode(CAN_INTpin, INPUT); // Setting pin 2 for /INT input Serial.println("#362 set MCP_NORMAL"); } else { Serial.println("#322 MCP2515 Init Failed"); } //EOF CAN */ Serial.println("WWWF _Slave_Ports_queue__list"); } //#if Active_ControllerID == _ControllerID // byte data[8] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; //#endif //String LCDarray1 ; //String LCDarray2 ; //unsigned long time; int loop_id = 0; void loop() { Serial.println("BBCC :loop " ); delay(1000); loop_id ++; // time = millis(); if( Slave_Ports_Status_C_ports_defined == 0) { Serial.println("AAXX Slave_Ports_Status_C_ports_defined = 0" ); Slave_Ports_Status_C_ports_defined = 1; Slave_Ports_Status_C.add_port( 1, 0x102, 0x01, 0x00, 1, 0x01, 0x01, 0x01, 0x01, 0x00); // Slave_Ports_Status_C.I2C_driver_F(Adafruit_PWMServoDriver) int _count_get = Slave_Ports_Status_C._count_get(); Serial.print("AVVV S_count_get: " ); Serial.println(_count_get ); // Slave_Ports_Status_C.add_port( 2, 0x102, 0x01, 0x00, 1, 0x01, 0x01, 0x01, 0x01, 0x00); // Slave_Ports_Status_C.I2C_driver_F(Adafruit_PWMServoDriver) //_count_get = Slave_Ports_Status_C._count_get(); //_count_get = Slave_Ports_Status_C._count_get(); // Slave_Ports_Status_C.add_port( 3, 0x102, 0x01, 0x00, 1, 0x01, 0x01, 0x01, 0x01, 0x00); // Slave_Ports_Status_C.I2C_driver_F(Adafruit_PWMServoDriver) // _count_get = Slave_Ports_Status_C._count_get(); } else { Serial.println("GGHH : Slave_Ports_Status_C_ports_defined =1" ); } Serial.write("Loop " ); Serial.println(loop_id ); delay(5000); //_LCD_print_buffors_list(_LCD_print_buffors) ; //_LCD_print_screens_list(_LCD_print_screens); }