mirror of
				https://github.com/node-red/node-red-nodes.git
				synced 2025-03-01 10:37:43 +00:00 
			
		
		
		
	mraa-gpio-ain: add iot2050 board
Add IOT2050 board in list of possible boards. Signed-off-by: zengchao <chao.zeng@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com>
This commit is contained in:
		| @@ -1,7 +1,7 @@ | |||||||
|  |  | ||||||
| <script type="text/javascript"> | <script type="text/javascript"> | ||||||
|     RED.nodes.registerType('mraa-gpio-ain',{ |     RED.nodes.registerType('mraa-gpio-ain',{ | ||||||
|         category: 'Intel gpio', |         category: 'GPIO', | ||||||
|         color: '#a6bbcf', |         color: '#a6bbcf', | ||||||
|         paletteLabel: 'analogue', |         paletteLabel: 'analogue', | ||||||
|         defaults: { |         defaults: { | ||||||
| @@ -27,6 +27,7 @@ | |||||||
|                 if (data === 5) { t = "Raspberry Pi"; } |                 if (data === 5) { t = "Raspberry Pi"; } | ||||||
|                 if (data === 6) { t = "Beaglebone"; } |                 if (data === 6) { t = "Beaglebone"; } | ||||||
|                 if (data === 7) { t = "Banana"; } |                 if (data === 7) { t = "Banana"; } | ||||||
|  |                 if (data === 25) { t = "IOT2050"; } | ||||||
|                 $('#btype').text(t); |                 $('#btype').text(t); | ||||||
|                 $('#node-input-pin').val(pinnow); |                 $('#node-input-pin').val(pinnow); | ||||||
|             }); |             }); | ||||||
| @@ -62,7 +63,7 @@ | |||||||
| </script> | </script> | ||||||
|  |  | ||||||
| <script type="text/x-red" data-help-name="mraa-gpio-ain"> | <script type="text/x-red" data-help-name="mraa-gpio-ain"> | ||||||
|     <p>An analogue input pin for an Intel Galileo or Edison board that is read every <i>interval</i> milliseconds.</p> |     <p>An analogue input pin for a board that is read every <i>interval</i> milliseconds.</p> | ||||||
|     <p>The <code>msg.payload</code> will contain the value, and <code>msg.topic</code> |     <p>The <code>msg.payload</code> will contain the value, and <code>msg.topic</code> | ||||||
|     contains "{the_board_name}/A{the pin number}".</p> |     contains "{the_board_name}/A{the pin number}".</p> | ||||||
|     <p>The value is only sent if it is different from the previously read value.</p> |     <p>The value is only sent if it is different from the previously read value.</p> | ||||||
|   | |||||||
| @@ -11,6 +11,10 @@ module.exports = function(RED) { | |||||||
|         var node = this; |         var node = this; | ||||||
|         var msg = { topic:node.board+"/A"+node.pin }; |         var msg = { topic:node.board+"/A"+node.pin }; | ||||||
|         var old = -99999; |         var old = -99999; | ||||||
|  |         // ADC set to 12 for IOT2050 | ||||||
|  |         if (this.board === "SIMATIC IOT2050") { | ||||||
|  |             node.x.setBit(12); | ||||||
|  |         } | ||||||
|         this.timer = setInterval(function() { |         this.timer = setInterval(function() { | ||||||
|             msg.payload = node.x.read(); |             msg.payload = node.x.read(); | ||||||
|             if (msg.payload !== old) { |             if (msg.payload !== old) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user