Changing board from UNO to MEGA

I ran out of I/O pins on the UNO.
The program works, so does the compilation for the UNO.

I now want to use a MEGA and updated the platformio.ini from this:

[env:uno]
platform = atmelavr
board = uno
framework = arduino
upload_port = /dev/ttyACM0
lib_deps =
	paulstoffregen/OneWire@^2.3.7
	knolleary/PubSubClient@^2.8
	arduino-libraries/Ethernet@^2.0.1

to this:

[platformio]
env_default = megaatmega2560
description = Garages controller: lights and doors

[env:uno]
platform = atmelavr
board = uno
framework = arduino

[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560

[env]
monitor_speed = 115200
upload_port = /dev/ttyACM0
lib_deps =
	paulstoffregen/OneWire@^2.3.7
	knolleary/PubSubClient@^2.8
	arduino-libraries/Ethernet@^2.0.1

However, the program will now not compile…
image

Though seemingly, there are two libdeps directories, one per platform:
image

this is the resulting error:


Update: I changed env_default to default_envs and back to `uno’. This compiles, but, it still gives me the red twigglies for the include files.


What steps am I missing?
Do I have to add these libraries again to the project?
Any hints appreciated.

You’re missing framework = arduino in this environment. That’s only in the Uno environment.

1 Like

Good spotting; thank you :slight_smile:

[Forrest and trees :slight_smile: ]

This is my new new platformio.ini, which works:

[platformio]
default_envs = megaatmega2560
;default_envs = uno
description = Garages controller: lights and doors

[env:uno]
platform = atmelavr
board = uno
framework = arduino
lib_deps = knolleary/PubSubClient@^2.8
	paulstoffregen/OneWire@^2.3.7
	arduino-libraries/Ethernet@^2.0.1

[env:megaatmega2560]
platform = atmelavr
board = megaatmega2560
framework = arduino
lib_deps = knolleary/PubSubClient@^2.8
	paulstoffregen/OneWire@^2.3.7
	arduino-libraries/Ethernet@^2.0.1

[env]
monitor_speed = 115200
upload_port = /dev/ttyACM0

The red wiggles, remained; until I closed VScode and reopened it.