Original Arduino code from the software page

  • Simomax
  • Simomax's Avatar Topic Author
  • Offline
  • Moderator
  • Moderator
  • Nuts about radioactive everything!
More
3 years 1 month ago - 3 years 1 month 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: }
}

Personal Use License:
You may download and save my content from this website for your personal use and enjoyment only. You may not share, redistribute, or transmit it to others, or use it commercially. All rights remain my own.
https://www.blinkyslab.co.uk/content-usage-notice
Last edit: 3 years 1 month ago by Simomax.

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

Moderators: Gamma-Man
Time to create page: 0.130 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 51% Memory 15% Swap 15% CPU temp=52.5'C Uptime 9 Days