I put this code in my B4R IDE (from here: https://www.b4x.com/android/forum/threads/servo-motor-and-arduino.66051/):
Selected the rServo library in the libraries manager.
Downloaded servo arduino library from https://github.com/arduino-libraries/Servo.
Got servo.h file from src folder there.
I put the servo.h file in my Additional Libraries folder.
Followed the directions here:
I followed the instructions there and modified my arduino-cli.yaml file to this:
board_manager:
additional_urls: []
directories:
user: D:\Downloads\B4R\Additional Libraries
I put the servo.h file in that Additional Libraries folder.
Still getting the same error message below.
Thanks in advance for the help!
cli: compile -b arduino:avr:mega D:\DOWNLO~1\B4R\TANK11~2\Objects\src\src.ino -v --board-options cpu=atmega2560
FQBN: arduino:avr:mega
Using board 'mega' from platform in folder: C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Detecting libraries used...
C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -IC:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\mega C:\Users\Owner\AppData\Local\arduino\sketches\D4B7B86979D7479C003C39D4EA72BCCE\sketch\src.ino.cpp -o nul
Alternatives for Wire.h: [Wire@1.0]
ResolveLibrary(Wire.h)
-> candidates: [Wire@1.0]
In file included from D:\Downloads\B4R\Tank11 Trying to get servo working - Copy\Objects\src\src.ino:1:0:
D:\Downloads\B4R\Tank11 Trying to get servo working - Copy\Objects\src\B4RDefines.h:23:10: fatal error: Servo.h: No such file or directory
#include <Servo.h>
^~~~~~~~~
compilation terminated.
C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -IC:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\mega -IC:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src C:\Users\Owner\AppData\Local\arduino\sketches\D4B7B86979D7479C003C39D4EA72BCCE\sketch\src.ino.cpp -o nul
Alternatives for Servo.h: []
ResolveLibrary(Servo.h)
-> candidates: []
Error during build: exit status 1
B4R servo:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public Serial1 As Serial
Public servo1 As Servo
Public pinservo As Pin
Public Timer1 As Timer
Public angleservo As UInt
Public upangle As Boolean
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
pinservo.Initialize (4,pinservo.MODE_OUTPUT) 'connect servo to pin 4 of Arduino
servo1.Attach(pinservo.PinNumber) 'assign servo to device on pin servo
Timer1.Initialize ("Timer1_Tick",1000) 'Call Timer every second
Timer1.Enabled=True
angleservo=servo1.Read 'initial servo angle
upangle=True 'Increment angle
End Sub
Sub Timer1_Tick
angleservo=servo1.read
Select upangle 'Increment angle
Case True
If (angleservo >=0 And angleservo <180) Then
Log ("up angle ",angleservo)
angleservo=angleservo +1
servo1.Write(angleservo)
End If
If angleservo=180 Then upangle=False
Case False 'Decrement angle
If angleservo <=180 And angleservo>0 Then
Log ("down angle ",angleservo)
angleservo=angleservo-1
servo1.Write(angleservo)
End If
If angleservo=0 Then upangle=True
End Select
End Sub
Selected the rServo library in the libraries manager.
Downloaded servo arduino library from https://github.com/arduino-libraries/Servo.
Got servo.h file from src folder there.
I put the servo.h file in my Additional Libraries folder.
Followed the directions here:
[SOLVED] <LiquidCrystal.h> not found - How to change libraries folder in arduino-cli
Good evening everyone, I kept postponing this but now that I have to correct something and I cannot do it, we have reached the node... What happens is that I had Arduino 1.8.19 installed in my computer and I had created an app that used Liquid Crystal Display. I completely removed the Arduino...
www.b4x.com
I followed the instructions there and modified my arduino-cli.yaml file to this:
board_manager:
additional_urls: []
directories:
user: D:\Downloads\B4R\Additional Libraries
I put the servo.h file in that Additional Libraries folder.
Still getting the same error message below.
Thanks in advance for the help!
cli: compile -b arduino:avr:mega D:\DOWNLO~1\B4R\TANK11~2\Objects\src\src.ino -v --board-options cpu=atmega2560
FQBN: arduino:avr:mega
Using board 'mega' from platform in folder: C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Detecting libraries used...
C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -IC:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\mega C:\Users\Owner\AppData\Local\arduino\sketches\D4B7B86979D7479C003C39D4EA72BCCE\sketch\src.ino.cpp -o nul
Alternatives for Wire.h: [Wire@1.0]
ResolveLibrary(Wire.h)
-> candidates: [Wire@1.0]
In file included from D:\Downloads\B4R\Tank11 Trying to get servo working - Copy\Objects\src\src.ino:1:0:
D:\Downloads\B4R\Tank11 Trying to get servo working - Copy\Objects\src\B4RDefines.h:23:10: fatal error: Servo.h: No such file or directory
#include <Servo.h>
^~~~~~~~~
compilation terminated.
C:\Users\Owner\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -IC:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\cores\arduino -IC:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\variants\mega -IC:\Users\Owner\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\libraries\Wire\src C:\Users\Owner\AppData\Local\arduino\sketches\D4B7B86979D7479C003C39D4EA72BCCE\sketch\src.ino.cpp -o nul
Alternatives for Servo.h: []
ResolveLibrary(Servo.h)
-> candidates: []
Error during build: exit status 1