/elec/quadcopter

To get this branch, use:
bzr branch http://bzr.ed.am/elec/quadcopter

« back to all changes in this revision

Viewing changes to src/rc-interface/main.ino

  • Committer: Tim Marston
  • Date: 2014-01-15 22:18:56 UTC
  • Revision ID: tim@ed.am-20140115221856-lcqttlborwi7ot7k
rc-interface: mostly completed it (untested, but rx and tx code should work)

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
#include "config.h"
47
47
#include "receiver.h"
48
48
#include "motors.h"
49
 
#include "comms.h"
 
49
#include "testing.h"
50
50
 
51
51
 
52
52
void setup()
53
53
{
54
54
        Receiver::setup();
55
55
        Motors::setup();
56
 
        Comms::setup();
57
 
 
58
 
        // led
59
 
        pinMode( LED_PIN, OUTPUT );
60
 
        digitalWrite( LED_PIN, LOW );
61
 
}
62
 
 
63
 
 
64
 
void flash_led()
65
 
{
66
 
        static bool on = false;
67
 
        on = !on;
68
 
        digitalWrite( LED_PIN, on? HIGH : LOW );
 
56
 
 
57
        Testing::setup();
69
58
}
70
59
 
71
60
 
72
61
void loop()
73
62
{
74
 
        int channel_values[ NUM_CHANNELS ];
 
63
        unsigned long channel_values[ NUM_CHANNELS ];
75
64
 
76
65
        while( true )
77
66
        {
78
 
                // have we read a whole set of channel values?
79
67
                if( Receiver::read_channels( channel_values ) )
80
68
                {
81
 
                        // yes, flash led!
82
 
                        flash_led();
83
 
 
84
 
                        // send channel values to main board
85
 
                        Comms::write_channels( channel_values );
86
 
 
87
 
                        // set motor speeds
88
 
                        Motors::set_values( channel_values );
 
69
                        Testing::draw_receiver_channels( channel_values );
89
70
                }
90
 
 
91
 
                // update motors
92
 
                Motors::update();
 
71
//              Motors::update_channels( channel_values );
93
72
        }
94
73
}