Original Arduino code from the software page

  • Simomax
  • Simomax's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Nuts about radioactive everything!
More
1 year 11 months ago - 1 year 11 months ago #6312 by Simomax
I'm posting the original Arduino code from the Software page here as I will be removing it from the Software page. This code is old and not complete and contains only the main functions. A new version should be written in the future.

Arduino

Here are some code snippets that should get you started:

Library include
s
#include <SPI.h>
#include <Ethernet.h>

Arrays and object definitions
byte mac = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; // MAC ADDRESS OF YOUR ETHERNET ADAPTOR
IPAddress ip(192,168,0,5);  // YOUR IP
IPAddress server(80.229.27.195); // RADMON.ORG IP, CHECK THIS
EthernetClient client;

Procedure to init
void init_ethernet()
{
    // give the ethernet shield a second to initialize:
    delay(1000);
    Ethernet.begin(mac, ip);
    delay(1000);
}

Procedure to send CPM value to radmon
void connect()
{
    if (client.connect(server, 80))
    {
        client.print("GET /radmon.php?function=submit&user=");
        client.print(UserName); client.print("&password=");
        client.print(PassWord); client.print("&value=");
        client.print(int(f_value[CPM]));
        client.print("&unit=CPM");
        client.println(" HTTP/1.0");
        client.println("HOST: radmon.org");
        client.println();
    }
else
    { // you didn't get a connection to the server: }
}
Last edit: 1 year 11 months ago by Simomax.

Please Log in or Create an account to join the conversation.

Moderators: Gamma-Man
Time to create page: 0.147 seconds
Powered by Kunena Forum
Everything's free. Please support us by considering a donation. Log in first!
Solar powered Raspberry Pi 4 server stats: CPU 38% Memory 21% Swap 70% CPU temp=50.6'C Uptime 71 Days