So I have some simple code for an Arduino device that I am trying to run on a Raspberry Pi, and I'm having some issues.
Here is the code:
#include <VirtualWire.h>
byte message[VW_MAX_MESSAGE_LEN]; // a buffer to store the incoming messages
byte messageLength = VW_MAX_MESSAGE_LEN; // the size of the message
void setup()
{
Serial.begin(9600);
Serial.println("Device is ready");
// Initialize the IO and ISR
vw_setup(2000); // Bits per sec
vw_rx_start(); // Start the receiver
}
void loop()
{
if (vw_get_message(message, &messageLength)) // Non-blocking
{
Serial.print("Received: ");
for (int i = 0; i < messageLength; i++)
{
Serial.write(message[i]);
}
Serial.println();
}
}
A couple of errors popped up when running it on my raspberry pi, such as:
receiver.c:13:1: error: unknown type name 'byte'
byte message[VW_MAX_MESSAGE_LEN]; // a buffer to store the incoming messages
^~~~
receiver.c:15:1: error: unknown type name 'byte'
byte messageLength = VW_MAX_MESSAGE_LEN; // the size of the message
^~~~
receiver.c: In function 'setup':
receiver.c:23:1: error: 'Serial' undeclared (first use in this function)
Serial.begin(9600);
So basically "byte" and "Serial" aren't working. Anyone have any ideas what I could replace these by?