Note de ce sujet :
  • Moyenne : 0 (0 vote(s))
  • 1
  • 2
  • 3
  • 4
  • 5
Attempt at cheap homemade version of Harmony
#45
Attached are the 2 Arduino codes. I couldn't attach ino files but pretty sure if the file extension is changed back to .ino they should open with Arduino IDE.

I've been a little reluctant to post the Arduino code because its been constantly evolving as I make improvements and find mistakes. I know very little about coding and know there will be a better way of writing it. Anyone's welcome to use it but I would suggest making you own modifications to it to make it suitable for your situation.

I currently use two Arduino's the second was at first for data logging but has now become the cadence measuring Arduino as well. Arduino 2 is not really necessary as the cadence measurement only helps to improve the accuracy. Data logging can be done via the Bluetooth connected to Arduino 1. You my not even want data logging I find it useful for developing the code.

The code of Arduino 1 can be simplified considerably. I'm considering getting rid of the mode selection by Bluetooth but it could be used for cadence selection instead. If you have a favourite cadence then there isn't a need for the shifter either. Or you could just use a simple switch instead for two settings.
The servo control is done by timer2 because at the time I didn't know how to make the reed switch timer code work on timer2. I now have a reed switch timer code working on timer2 on Arduino 2 which could be adapted to calculate wheel. This would allow the servo library to be used.

The I2C needs to be able to transfer more values to Arduino 2 so I can free up one of the timers for a back up servo control code. Always more to be done but at the moment the basics of this code works very well.


Pièces jointes
.txt   Arduino1_Code_V6.4.1.txt (Taille : 23.85 Ko / Téléchargements : 14)
.txt   Arduino2_Code_V6.4.1.txt (Taille : 8.37 Ko / Téléchargements : 11)
- Oran
Répondre


Messages dans ce sujet
RE: Attempt at cheap homemade version of Harmony - par Oran - 2017-04-21, 16:29

Atteindre :


Utilisateur(s) parcourant ce sujet : 4 visiteur(s)