Iron Man, Articulated, Wearable [Box and Loop]

Hello! I'm trying to building Iron Man helmet from Box and Loop Youtube Video Here

I ordered a knock off Arduino Nano Every from Aliexpress and it's giving me issues. I've found out that it's a Atmega4808 model and I've installed the Thinary AVR Boards plugin but now the code doesn't work. Can someone help me get it to work with this board?

The original code is here:

#include "ServoEasing.h"
ServoEasing servoTop;
ServoEasing servoBottom;
const int action_pin = 2;
const int ledPin = 6;
const int potPin = A0;
int location = 31;
int bottom_closed = 107;
int top_closed = 167;
int bottom_open = 20;
int top_open = 20;
int value;
int maxBrightness;

void setup()
{
  pinMode(action_pin, INPUT_PULLUP);
  pinMode(potPin, INPUT);
  servoTop.attach(9);
  servoBottom.attach(10);
  setSpeedForAllServos(190);
  servoTop.setEasingType(EASE_CUBIC_IN_OUT);
  servoBottom.setEasingType(EASE_CUBIC_IN_OUT);
  synchronizeAllServosStartAndWaitForAllServosToStop();
}

void loop()
{
  value = analogRead(potPin);
  maxBrightness = map(value, 250, 750, 0, 255);
  int proximity = digitalRead(action_pin);
  if (proximity == LOW)
  {
    if (location > bottom_open) {
      servoTop.setEaseTo(top_open);
      servoBottom.setEaseTo(bottom_open);
      synchronizeAllServosStartAndWaitForAllServosToStop();
      location = bottom_open;
      delay(10);
      analogWrite(ledPin, 0);
    } else {
      servoTop.setEaseTo(top_closed);
      servoBottom.setEaseTo(bottom_closed);
      synchronizeAllServosStartAndWaitForAllServosToStop();
      location = bottom_closed;
      delay(50);
      analogWrite(ledPin, maxBrightness / 3);
      delay(100);
      analogWrite(ledPin, maxBrightness / 5);
      delay(100);
      analogWrite(ledPin, maxBrightness / 2);
      delay(100);
      analogWrite(ledPin, maxBrightness / 3);
      delay(100);
      analogWrite(ledPin, maxBrightness);
      delay(100);
    }
  }
}

When I try to verify/upload this code, this is the error I get. I'm completely new to this and have no idea what to do to fix it:

C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp: In function 'void TIMER1_COMPA_vect()':
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:82:31: error: 'TCNT1' was not declared in this scope
   handle_interrupts(_timer1, &TCNT1, &OCR1A);
                               ^~~~~
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:82:31: note: suggested alternative: 'TCB1'
   handle_interrupts(_timer1, &TCNT1, &OCR1A);
                               ^~~~~
                               TCB1
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:82:39: error: 'OCR1A' was not declared in this scope
   handle_interrupts(_timer1, &TCNT1, &OCR1A);
                                       ^~~~~
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp: In function 'void initISR(timer16_Sequence_t)':
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:128:5: error: 'TCCR1A' was not declared in this scope
     TCCR1A = 0;             // normal counting mode
     ^~~~~~
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:128:5: note: suggested alternative: 'TCB1'
     TCCR1A = 0;             // normal counting mode
     ^~~~~~
     TCB1
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:129:5: error: 'TCCR1B' was not declared in this scope
     TCCR1B = _BV(CS11);     // set prescaler of 8
     ^~~~~~
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:129:5: note: suggested alternative: 'TCB1'
     TCCR1B = _BV(CS11);     // set prescaler of 8
     ^~~~~~
     TCB1
In file included from c:\users\silen\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:99:0,
                 from c:\users\silen\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\interrupt.h:38,
                 from C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:22:
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:129:18: error: 'CS11' was not declared in this scope
     TCCR1B = _BV(CS11);     // set prescaler of 8
                  ^
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:129:18: note: suggested alternative: 'B111'
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:130:5: error: 'TCNT1' was not declared in this scope
     TCNT1 = 0;              // clear the timer count
     ^~~~~
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:130:5: note: suggested alternative: 'TCB1'
     TCNT1 = 0;              // clear the timer count
     ^~~~~
     TCB1
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:136:5: error: 'TIFR1' was not declared in this scope
     TIFR1 |= _BV(OCF1A);     // clear any pending interrupts
     ^~~~~
In file included from c:\users\silen\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:99:0,
                 from c:\users\silen\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\interrupt.h:38,
                 from C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:22:
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:136:18: error: 'OCF1A' was not declared in this scope
     TIFR1 |= _BV(OCF1A);     // clear any pending interrupts
                  ^
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:137:5: error: 'TIMSK1' was not declared in this scope
     TIMSK1 |=  _BV(OCIE1A) ; // enable the output compare interrupt
     ^~~~~~
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:137:5: note: suggested alternative: 'TIMERB1'
     TIMSK1 |=  _BV(OCIE1A) ; // enable the output compare interrupt
     ^~~~~~
     TIMERB1
In file included from c:\users\silen\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\io.h:99:0,
                 from c:\users\silen\appdata\local\arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino5\avr\include\avr\interrupt.h:38,
                 from C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:22:
C:\Users\silen\AppData\Local\Arduino15\libraries\Servo\src\avr\Servo.cpp:137:20: error: 'OCIE1A' was not declared in this scope
     TIMSK1 |=  _BV(OCIE1A) ; // enable the output compare interrupt
                    ^

exit status 1

Compilation error: exit status 1

I strongly suspect the code is for a different Arduino version using a different processor - what processor was being used by whoever wrote the code ? ( note the 4808 and 4809 have different number of timers )

The other thing that springs to mind is whether you installed the servo easy library ?

The good news is this is a fairly simple task and you could write your own code based on servo examples for the board you have. Try and see if the examples work .

Buy genuine !!

Data sheet

This is the one the developer suggested buying. I found mine on Aliexpress because I thought it was the same. I did't even know knock-offs were a thing until now.

This is all way above my head. Can you give me an example of how I would re-write this? Or, maybe a tutorial of some kind?

Hi, @erraddict
Welcome to the forum.

Can you please tell us your electronics, programming, arduino, hardware experience?

Can you please post a copy of your circuit a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.

Thanks.. Tom.. :grinning: :+1: :coffee: :australia:

Buy your Arduino from Arduino , those from other retailing outlets may well be fakes .

The easiest thing is to buy a genuine one and use an example from the servo library . Nano Every is cheap !!
When you have more experience you can deal with the fakes .( inc Amazon). The link you show however looks good as it goes to the Arduino web site

Here

Parts needed are in the description of this youtube video. I can only add a few link so it's easier to get them all from there.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.