2020-04-10, 09:15 PM
(2020-04-10, 12:03 AM)ironman Wrote:(2020-04-09, 08:29 PM)Wim Wrote: I have installed OP2 and have updated the motor.ino and this is not functioning. When loading the previous version of motor.ino all works fine. My set up is with a Velleman Arduino Nano and a BT 2. Working code is
Code:/* Copyright (C) 2019 Sean D'Epagnier <seandepagnier@gmail.com>
*
* This Program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*/
Anyone an idea where things could go wrong?
If you got the latest version of motor.ino from github, and you got a NO MOTOR CONTROLLER message, there's a known issue with DIV_BOARD; setting it to 1 has been known to help. See this post.
Just gone through the code. However shall both be set to 1?
Code:
uint32_t start = micros();
while(!calculated_clock); // wait for watchdog to fire
clock_time = micros() - start;
uint8_t div_board = 1; // 1 for 16mhz
if(clock_time < 2900) // 1800-2600 is 8mhz, 3800-4600 is 16mhz
div_board = 2; // detected 8mhz crystal, otherwise assume 16mhz