Hi from Portugal :D Im a noobie-noobie (more is impossible) on Moteino/Arduino and special in code. I suck big time! But I start a project with 2 Moteino with RF69W at 868Mhz.
The project (from Adi Soffer) have the code for the RF12 I try to change but i got a error in the Arduino IDE. If some one could help me i would be very thankful.
This is the code:
http://pastebin.com/UzudqQnY
The error:
radio.Initialize(NODEID, RF69_868MHZ, NETWORKID);
'class RFM69' has no member named 'Initialize' If i delet this line everything compile good.
Thanks in advance for the help =))
Cheers
Tiago
Hi from a huge winter storm in Michigan USA!
So you're converting a sketch from RFM12B to RFM69. There are a few essential differences.
Notice the two declarations for the initialize functions, names are different (C is CASE SENSITIVE), and arguments are in different order:
void Initialize(uint8_t nodeid, uint8_t freqBand, uint8_t groupid=0xAA, uint8_t txPower=0, uint8_t airKbps=0x08, uint8_t lowVoltageThreshold=RF12_2v75);
bool initialize(byte freqBand, byte ID, byte networkID=1);
Im sorry for the storm, good time to stay at home drinking a good tea and thinking in good new stuff from LowPowerLab ;D
Thanks for the fast reply. I really don't understand nothing about code. Im trying, believe me. I have made some changes and then stay stuck in that error line. With your help i have change the I to an i in the initialize word. But after that it just stuck with other error:
Receiver.ino: In function 'void setup()':
Receiver:98: error: 'class AccelStepper' has no member named 'setMinPulseWidth'
Receiver.ino: In function 'void loop()':
Receiver:110: error: 'class RFM69' has no member named 'ReceiveComplete'
Receiver:117: error: 'class RFM69' has no member named 'GetDataLen'
Receiver:119: error: 'class RFM69' has no member named 'Data'
Receiver.ino: In function 'int Transmit(int)':
Receiver:278: error: 'class RFM69' has no member named 'Wakeup'
Receiver:279: error: 'class RFM69' has no member named 'Send'
Receiver:280: error: 'class RFM69' has no member named 'Sleep'
Wish to know better =(( and not having to do this kind of questions. But i think with time i can progress better.
Thanks you so much for the help.
Should i change from,
void setup
to
bool setup
???
Ok, I don't know what setMinPulseWidth is and what header file you need for that.
For all the RFM69 errors you will need to change the function names from the RFM12B old names to the RFM69 names similar to the initialize function (that was an easy change). Some functions work differently in the RFM69 lib, for instance ReceiveComplete is receiveDone in RFM69. The Data is DATA, Wakeup and Sleep are wakeup/sleep, and Send is either send or better alternative sendWithRetry(...). Please look at the header files for the actual names and parameter order, and also look at the examples in the RFM69 library where all the working code is already in place. I would probably start with a working example and add your custom code rather than migrate from RFM12B. But here are the header files and examples for RFM69:
https://github.com/LowPowerLab/RFM69/blob/master/RFM69.h
https://github.com/LowPowerLab/RFM69/tree/master/Examples
Thank you Felix, you are great :D
The setMinPulseWidth is because the library AccelStepper was wrong, now that part is ok, because i reinstall it the librery again. It's so good wend you find the error =)) Thanks you for the links and explanation. I will ready and test more. Im in the midle of the code with the changes for the RF69
if (radio.ReceiveComplete())
Receiver.ino: In function 'void loop()':
Receiver:110: error: 'class RFM69' has no member named 'ReceiveComplete'
Receiver:117: error: 'class RFM69' has no member named 'GetDataLen'
Receiver:119: error: 'class RFM69' has no member named 'Data'
Receiver.ino: In function 'int Transmit(int)':
Receiver:278: error: 'class RFM69' has no member named 'Wakeup'
Receiver:279: error: 'class RFM69' has no member named 'Send'
Receiver:280: error: 'class RFM69' has no member named 'Sleep'
Need to read your tips and see what is wrong. For the first time that i touch in code... =))
All most there =))
I Just got more 2 errors
for (byte i = 0; i < radio.GetDataLen(); i++)
Receiver.ino: In function 'void loop()':
Receiver:117: error: 'class RFM69' has no member named 'GetDataLen'
I saw in RF69.h that is writing static volatile byte DATALEN; and i have change to GetDATALAN but still give's me the error.
I have change from W to w and still give's me this error
Receiver.ino: In function 'int Transmit(int)':
Receiver:278: error: 'class RFM69' has no member named 'wakeup'
YEAHHHH i think i solve more one =)))
In the RFM12 code are:
for (byte i = 0; i < radio.GetDataLen(); i++)
and i change to
for (byte i = 0; i < radio.DATALEN; i++)
I change the function and take the brackets. Are this correct?
Wake or wake are not from RFM69. For what i should change?
the DATALEN is correct, you got it.
I was wrong about wake. There is no wakeup in RFM69, only a sleep() function. When you want to wake the radio, you don't have to do anything, just use send() or sendWithRetry() directly and the radio will wake up. So I think if you remove that you're all done.
YEAHHHHHH I SOLVE ONE by my self ;D coff, coff... THANK YOU FELIX
While im writing this im trying the code and i remove the line: radio.wakeup ();
and now fail to compile =((
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp: In member function 'bool RFM69::initialize(byte, byte, byte)':
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:65: error: 'SPI' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:65: error: 'SPI_MODE0' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:67: error: 'SPI_CLOCK_DIV2' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp: In member function 'void RFM69::sendFrame(byte, const void*, byte, bool, bool)':
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:212: error: 'SPI' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp: In member function 'virtual void RFM69::interruptHandler()':
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:242: error: 'SPI' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp: In member function 'void RFM69::encrypt(const char*)':
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:309: error: 'SPI' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp: In member function 'byte RFM69::readReg(byte)':
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:333: error: 'SPI' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp: In member function 'void RFM69::writeReg(byte, byte)':
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:342: error: 'SPI' was not declared in this scope
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp: In member function 'void RFM69::readAllRegs()':
C:\Users\SKAT VILLE\Documents\Arduino\libraries\RFM69\RFM69.cpp:393: error: 'SPI' was not declared in this scope
Again, back to the examples and try to see whats wrong. Uhmmm maybe i need <SPI.h> library =))
Edit:
...and this is what i like the feeling, DONE !!! Just need to include the <SPI.h> library. Thanks Felix 8)
Now i go to the sender/transmitter try to solve de code. Did i say solve de code?? lol ;D i wish =DD
Try adding this to the top of your sketch:
#include <SPI.h>
When you removed that line did you accidentally delete anything else?
I don't see a
#include <SPIFlash.h>
statement in your pastebin code. It looks like you have removed most of the stuff related to SPI from your code, but from the error messages it looks like some of the RFM69 code may need the SPI file.
LG
Thank you guys. I have edit the post above... Need the line/library #include<spi.h> and then everything as compile. Im learning so much but i need to learn more or start to learn C++ i come from Pascal and is so old, old, old that i don't remember nothing... but at that time i was the best at my class ;D
Regarding the line wakeup that i take out im afraid that something don't work good after. I got the Moteinos but still waiting for the stepper motor and the easydriver. Get this time for see and change the code.
I start now with the sender/transmitter and almost all the problems solve. Now it show up that 'class RFM69' has no member named 'CRCPass' can i change this for a working name?
RFM69 lib does not have a CRCPass function. Look at the examples how a packet is received. Basically the CRCPass step is completely eliminated - because it makes no sense to check whether a packet has passes CRC or not - (ie if it doesn't it's garbage and you never want to hear about it). The RFM69 transceiver has a mechanism by which it automatically filters out the bad CRC packets and only notifies you when good packets arrive, which is awesome, less code to mess with.
Thanks again Felix, very appreciated. I have remove if (radio.CRCPass()) and everything compile good. I can see that RFM69 is more simple. From my last post i have digging in the internet looking for CRCPass + RFM69 and didn't find anything that help me... and for that i should see that RFM69 didn't use ( i didn't see also in RFM69.h) CRCPass and i should take it off from the code... but have afraid that something didn't work good.
Hope other people can use this post for achieve the transition from RFM12 to RFM69. With the trill that i have doing this i don't want to stop... it's a good rush/feeling =)) Need to learn more and so i have a few questions if Felix or other beloved fellows what/know to hawser.
1- Can i attach to Moteino one screen in particular this one? http://www.ebay.de/itm/1-8-Serial-128X160-SPI-TFT-LCD-Module-Display-PCB-Adapter-with-SD-Socket-/380809480973?pt=Bauteile&hash=item58aa038b0d
2-What Library's do i need to operate this screen? What i want to try is instead of having led's showing what im doing it's show on screen. Like the name of what im doing.
3- What is the best language to learn programming/code the Moteino? C++ ?
Thanks again for the help, this is a new world for me and for my friends, now they all want to try this thing... Moteino! Let's go :D
For new comers like you the best place to start is the examples, and the forum as a place to get help.
To answer the other questions ...
1) Not familiar with that particular LCD. Others have posted in the forum about using a smaller SSD1306 OLED display: http://lowpowerlab.com/forum/index.php/topic,119.0.html
There are many other displays that work with Arduino. I would start by googling "Arduino LCD" or "Arduino display". Don't forget Moteino will only provide 3.3V if you power your LCD from the Moteino "3.3" pin.
2) I don't know, looks like the seller did not include any links or much informatio on how to actually use that product.
3) C++. The Arduino "language" is actually a lightly wrapped C++. Or you could try assembly but I would not recommend that :P
Thanks Felix :D Yes, examples are good but i need to understand a bit more the language and, if im not talking wrong, i need to understand the structure of C++ I start to read the book C++ for Dummies and plus the examples i think will be a good start :)
I take your advice and went search for other LCD in Ebay and come across with this http://www.ebay.com/itm/SPI-1-5-Full-Color-OLED-Module-for-Arduino-AVR-PIC-STM-ARM-PI-/131084066474?pt=LH_DefaultDomain_0&hash=item1e85381eaa With this specifications i can assume that this OLED works with Moteino because this work with Arduino UNO?
SPI 1.5" Full Color OLED Module for Arduino Uno
Supply:3V3~5V.
Logic:3V3~5V.
Max Colors:262,144 Colors.
Matrix:128(RGB)x128
Interfaces:4-wire SPI
Pins list:
GND
VCC (3V3~5V)
EN(for HV)
CLK
DIN
DC
CS
REST
Arduino UNO sources code (working in 64K Mode) <------ ?!?!?
Download it from: oled.jimdo.com
It have download the source code but i open and is big and complicated. One question, the pin's from Arduino UNO like...
#define RST_PIN 8
#define CS_PIN 9
#define DC_PIN 10 <------ In Moteino D10 is for the transceiver?
#define DIN_PIN 11
#define CLK_PIN 12
#define HVEN_PIN 13
...are the same in Moteino?
The screen is "just" for tell me what function im doing wend pressing a button (or two). I think the wire connection is not so difficult but the code... Can you direct me or something for i integrate this OLED in the code? Need to read/understand the 3 library's that the source code use...? I think it use 3 library's but because the screen is doing geometric stuff in the example/video. Maybe for show what you are doing wend press a butt could be more easy. Or is better not trying implement the OLED just because is to much for a newbie like me??
Code:
http://pastebin.com/r4W9NgFD
Source code for th OLED:
http://pastebin.com/NUw0uNPj
I only took a quick look at the library for that OLED display, but I could only see functions for drawings graphics (lines, colors, etc.), I didn't see anything for text. So you'll have to write a LOT of code to draw stuff on that display.
Text displays are lot easier to work with, you just send them a string of characters and it prints them on the screen. Felix used a 2 line LCD display for his Mailbox Notifier project and I think you'd find it much easier to work with, and you'll have Felix's code to see how he made the display work - http://lowpowerlab.com/blog/2013/08/27/mailbox-notifier-project-upgrade/
Another good place to look for LED/ LCD/ OLED/ Eink Displays and tutorials for connecting them is at AdaFruit. A fairly extensive explanation is here:
http://learn.adafruit.com/character-lcds (http://learn.adafruit.com/character-lcds) and they carry several different types. Including a back pack unit that for a little more cash makes programming easier. http://www.adafruit.com/products/292 (http://www.adafruit.com/products/292)
LG
Thanks LazyGlen and KanyonKris, very appreciated for the information.
-Now i understand a litle bit more about library's. If i want put color OLED need to see the library if got functions for text/print... For sure that exist some kind of library that work with text... need to search more =))
-2 line LCD for start can be a good choise. Back to the cave to read more =)))
arrinkiiii,
If it works with UNO it should work with Moteino. Just mind that everything is 3.3V on Moteino.
Having said that the LCD specs look good, you can interface logic and powerd to/from 3.3V Moteino directly.
The D10 is offlimits because it's used by the transceiver (if one is present) so use another digital pin (not D2 - also transceiver, and not D8 if you got a SPIFlash chip present).
Hi Felix, thanks for the detail information =))
So... need to have a screen that is power up with 3,3v for i able to connect direct to Moteino. But what i can see is that exist a lot of screens (TFT/LCD/OLED) but not all screens have library's and some screens come only with library's for design and not for text.
This is true? What i want to say is, wend i looking for a screen to Moteino/Arduino is better that have a library that support text?
I think i will go to this OLED http://www.ebay.com/itm/1-8-Serial-UART-I2C-SPI-True-Color-OLED-160x128-Display-Module-for-Arduino-PIC-/370962965005?pt=LH_DefaultDomain_0&hash=item565f1da20d Got library's, a lot of information and they say can operate from 1 pin to 3 pin's depending what kind of communications you want to use (UART/I2C/SPI). I think for what i see so far this is the most simple and with more information.
If someone can tell me in short and simple words, what communication (UART/I2C/SPI) i should use and why and the differences between them?
Given the questions you are asking, it is better that you have screen/ library that supports text. We all have to start somewhere, and I would not want to start with a graphical display myself. (I'm using one of the 16x2 with blueish background shown on page 2 of the link I posted to learn how it works myself.)
I took a brief look at the unit you linked, it looks very nice, and has options. Options can be good or confusing. Download the code and take a good look at it. I think I would use I2C personally, but I already have I2C temp sensors talking with my Moteino's. So I have the I2C library and a little bit of knowledge. SPI code/library is also available if you have a FLASH chip. Look at how the example code works. Chances are, one will make more sense to you than another, that's probably the one you should start with.
LG
Hi LG
Thanks for the info, very appreciated =)) My Moteino have chip (didn't want but in Portugal i just have found with the chip) But i think i will go for the I2C communication/protocol. You say that you have the I2C library, this library can be use with any screen that can communicate in IC2 ? Do you know what communication use less pin's (UART/I2C/SPI)?
Sorry for so many question, but more i learn more questions i have :D
Quote from: arrinkiiii on January 10, 2014, 02:29:38 PM
Hi LG
Thanks for the info, very appreciated =)) My Moteino have chip (didn't want but in Portugal i just have found with the chip) But i think i will go for the I2C communication/protocol. You say that you have the I2C library, this library can be use with any screen that can communicate in IC2 ? Do you know what communication use less pin's (UART/I2C/SPI)?
Sorry for so many question, but more i learn more questions i have :D
My preference is I2C. It is not as fast as SPI for transferring data, but the projects I am doing this is not an issue. The thing I like about I2C is that it includes addressing in the data packets. So you connect power and ground, then SDA (Serial
DAta) and SCL (Serial
CLock) to any and all (well, up to 127) devices. Once you get the addressing set up, you simply put a request on the bus to write or read information to or from an address, and the device at that address responds.
SPI has the issue (for ME) that every time you add a device, you burn another pin for a chip select. This is why if you have FLASH on your Moteino, D8 is not available, the FLASH chip would get activated when you use it. It seems to me like every time I settle on a pin for something, some shield decides that is the hard wired pin for some random SPI device. (You hear me Ethernet Shield!?) http://www.seeedstudio.com/wiki/Ethernet_Shield_V2.0 (http://www.seeedstudio.com/wiki/Ethernet_Shield_V2.0)
QuoteFrom the SeedStudio writeup on their Ethernet Sheild
Notice:
Both W5200 and SD card communicate with Arduino via SPI bus. Pin 10 and pin 4 are chip select pins for W5200 and SD slot. They cannot be used as general I/O.
Think of it like this: You have N friends you want to be able to talk to on the phone. You can either set up a phone system that is fast, but needs a dedicated phone per friend, so you have N phones in your house. If you make a new friend, you add another phone. OR You set up a phone system that isn't quite as fast, but the phone you install has a number pad on it, you assign each friend a number (address). When you want to talk to one of them, you punch the number and the call is routed to that person. To add another friend, you simply assign them an address on the same system.
This is my biased take on it. I found a more well balanced discussion here:http://www.eevblog.com/forum/suggestions/uart-spi-i2c/ (http://www.eevblog.com/forum/suggestions/uart-spi-i2c/)
If the display that you are looking to buy uses standard I2C, the standard I2C library should talk to it.
LG
After read 2 and 3 times, your good documented text, i will go for I2C =)) Also many thanks for the the link. With your examples and with the link i understand a lot better, thank you.
I will check the I2C library, every time that i learn a bit more i need to read again everything and each time i read again the same words, lines, text's they sound different, they make more sense/meaning.
The screen that i think to buy have a library and exist a few one's on the internet... need to check and see how i can make the code. I know (i think) that the function is print() for output text in the screen.
http://www.ebay.com/itm/1-8-Serial-UART-I2C-SPI-True-Color-OLED-160x128-Display-Module-for-Arduino-PIC-/370962965005?pt=LH_DefaultDomain_0&hash=item565f1da20d