Реализован Slave на Arduino с использованием Modbus.
This commit is contained in:
		
							parent
							
								
									3884b3f997
								
							
						
					
					
						commit
						29b2991fc5
					
				
							
								
								
									
										18
									
								
								sketch_apr29a/sketch_apr29a.ino
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								sketch_apr29a/sketch_apr29a.ino
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,18 @@ | |||||||
|  | #include <ModbusSerial.h> | ||||||
|  | const int GPIOCoil = 0; | ||||||
|  | 
 | ||||||
|  | bool coils[10]; | ||||||
|  | const int pinToRead = 2; | ||||||
|  | 
 | ||||||
|  | ModbusSerial mb (Serial, 10); | ||||||
|  | 
 | ||||||
|  | void setup() { | ||||||
|  |   Serial.begin(9600); | ||||||
|  |   pinMode(pinToRead, INPUT); | ||||||
|  |   mb.addIsts(0); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void loop() { | ||||||
|  |   mb.setIsts(0 digitalRead(pinToRead)); | ||||||
|  |   mb.task(); | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user