<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[SOLVED] Itead Rboard 2.1.1]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I've been using Mysensors for a long time without need to update from version 1.4!  :)</p>
<p dir="auto">Most of my nodes are mains powered and use relay's for switching lots of different stuff. Recently I have updated my serial gateway, uno's and nano's to 2.1 without problem, however, not so lucky with the Itead Rboard. <a class="plugin-mentions-user plugin-mentions-a" href="/user/gregl" aria-label="Profile: gregl">@<bdi>gregl</bdi></a> helped me last time by showing me how to reference pins 8 &amp; 9 for CE/CS. Could someone please help me understand what I must modify in a sketch using version 2.1.1?</p>
<p dir="auto">Thanks,<br />
Tim</p>
<p dir="auto">Re: <a href="/topic/364/itead-rboard-4-relay">ITEAD RBoard (4 relay)</a></p>
]]></description><link>https://forum.mysensors.org/topic/8027/solved-itead-rboard-2-1-1</link><generator>RSS for Node</generator><lastBuildDate>Tue, 17 Mar 2026 00:02:32 GMT</lastBuildDate><atom:link href="https://forum.mysensors.org/topic/8027.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 22 Nov 2017 12:17:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [SOLVED] Itead Rboard 2.1.1 on Thu, 23 Nov 2017 03:26:03 GMT]]></title><description><![CDATA[<p dir="auto">This page helped me solve the problem.</p>
<p dir="auto">Regards,<br />
Tim</p>
<p dir="auto"><a href="https://www.mysensors.org/download/sensor_api_20" rel="nofollow ugc">https://www.mysensors.org/download/sensor_api_20</a></p>
<pre><code>/**
 * The MySensors Arduino library handles the wireless radio link and protocol
 * between your home built sensors/actuators and HA controller of choice.
 * The sensors forms a self healing radio network with optional repeaters. Each
 * repeater and gateway builds a routing tables in EEPROM which keeps track of the
 * network topology allowing messages to be routed to nodes.
 *
 * Created by Henrik Ekblad &lt;henrik.ekblad@mysensors.org&gt;
 * Copyright (C) 2013-2015 Sensnology AB
 * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
 *
 * Documentation: http://www.mysensors.org
 * Support Forum: http://forum.mysensors.org
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2 as published by the Free Software Foundation.
 *
 *******************************
 *
 * REVISION HISTORY
 * Version 1.0 - Henrik Ekblad
 *
 * DESCRIPTION
 * Example sketch showing how to control physical relays.
 * This example will remember relay state after power failure.
 * http://www.mysensors.org/build/relay
 */

// Enable debug prints to serial monitor
#define MY_DEBUG

// Enable and select radio type attached
#define MY_RADIO_NRF24
//#define MY_RADIO_RFM69

//CE/CS Pins
#define MY_RF24_CE_PIN 8
#define MY_RF24_CS_PIN 9

// Enable repeater functionality for this node
#define MY_REPEATER_FEATURE

#include &lt;MySensors.h&gt;

#define RELAY_1  4  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
#define NUMBER_OF_RELAYS 4 // Total number of attached relays
#define RELAY_ON 1  // GPIO value to write to turn on attached relay
#define RELAY_OFF 0 // GPIO value to write to turn off attached relay


void before()
{
	for (int sensor=1, pin=RELAY_1; sensor&lt;=NUMBER_OF_RELAYS; sensor++, pin++) {
		// Then set relay pins in output mode
		pinMode(pin, OUTPUT);
		// Set relay to last known state (using eeprom storage)
		digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
	}
}

void setup()
{

}

void presentation()
{
	// Send the sketch version information to the gateway and Controller
	sendSketchInfo("Relay", "1.0");

	for (int sensor=1, pin=RELAY_1; sensor&lt;=NUMBER_OF_RELAYS; sensor++, pin++) {
		// Register all sensors to gw (they will be created as child devices)
		present(sensor, S_BINARY);
	}
}


void loop()
{

}

void receive(const MyMessage &amp;message)
{
	// We only expect one type of message from controller. But we better check anyway.
	if (message.type==V_STATUS) {
		// Change relay state
		digitalWrite(message.sensor-1+RELAY_1, message.getBool()?RELAY_ON:RELAY_OFF);
		// Store state in eeprom
		saveState(message.sensor, message.getBool());
		// Write some debug info
		Serial.print("Incoming change for sensor:");
		Serial.print(message.sensor);
		Serial.print(", New status: ");
		Serial.println(message.getBool());
	}
}

</code></pre>
]]></description><link>https://forum.mysensors.org/post/80083</link><guid isPermaLink="true">https://forum.mysensors.org/post/80083</guid><dc:creator><![CDATA[timg]]></dc:creator><pubDate>Thu, 23 Nov 2017 03:26:03 GMT</pubDate></item></channel></rss>