shackremote_arduino.ino 1.22 KB
Newer Older
andz's avatar
andz committed
1
2
3
4
5
6
///
/// @file       shackremote.ino
/// @copyright  Christian Obersteiner, Andreas Müller - CC-BY-SA 4.0
///
/// @brief  Contains all arduino stuff for the rotor control
///
chris007's avatar
chris007 committed
7
8
9
10
11
12
13
14

#include <Arduino.h>
#include "settings.h"

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

#include "rotor.h"
15
#include "hamlib.h"
chris007's avatar
chris007 committed
16
17

// Network Settings
andz's avatar
andz committed
18
/// @todo move to settings.h
19
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0x13, 0x37 };
andz's avatar
andz committed
20
21
IPAddress ip(83,133,178,126);
unsigned int localPort = 51337;
chris007's avatar
chris007 committed
22

Markus's avatar
Markus committed
23
Rotor rotor;
24
25
CHamlib hamlib;
EthernetUDP udp;
andz's avatar
andz committed
26
int debugTime;
chris007's avatar
chris007 committed
27
28
29

void setup()
{
30
31
32
    // Init
    rotor.initRotor();

andz's avatar
andz committed
33
34
35
36
37
38
39
    // Open serial communications and wait for port to open:
    Serial.begin(19200);
    while (!Serial) {
        ; // wait for serial port to connect. Needed for Leonardo only
    }

    // start the Ethernet connection:
Markus's avatar
Markus committed
40
41
    //Ethernet.begin(mac, ip);
    //udp.begin(localPort);
42
43

    // init Hamlbib
Markus's avatar
Markus committed
44
    //hamlib.initHamlib(&udp, &rotor);
andz's avatar
andz committed
45
46
47

    //Debug
    debugTime = 0;
Markus Mueller's avatar
Markus Mueller committed
48
    rotor.setElevation(170);
Markus's avatar
Markus committed
49
    rotor.setAzimuth(42);
chris007's avatar
chris007 committed
50
51
52
53
}

void loop()
{
Markus Mueller's avatar
Markus Mueller committed
54
    //hamlib.receiveHamlibPacket();
55
    rotor.doRotor();
Markus Mueller's avatar
Markus Mueller committed
56
    //hamlib.sendHamlibPacket();
57
58
59

    if(debugTime > 100)
    {
Markus's avatar
Markus committed
60
        //hamlib.debugOut();
61
62
63
64
65
        rotor.debugOut();
        debugTime = 0;
    }
    debugTime++;
}