VisualTeensy upgraded to support Teensy 4 projects

It seems that it searches Arduino only under C:/program Files etc. but I typically install Arduino in user space (C:-/users/.../...)
mind to add this search path?
 
C:/program Files etc.

That's true. I'll extend the search range a bit. Might also be good to have a dialog to manually set the Arduino location if it doesn't find one.
 
Last edited:
good idea, as people with a ssd boot drive typically install things to a HD (I have a ssd boot C: and install things to a hd D:)
 
It seems that it searches Arduino only under C:/program Files etc. but I typically install Arduino in user space (C:-/users/.../...)
mind to add this search path?
good idea, as people with a ssd boot drive typically install things to a HD (I have a ssd boot C: and install things to a hd D

Here a new release which should improve the first startup. It doesn't try to be smart anymore and simply provides a dialog to select an Arduino-folder manually instead.
https://github.com/luni64/VisualTeensy/releases

Let me know if this works for you
 
@luni, can please contact me via mail ? I've private messages turned off and can't write to you.#Click on my name and then "Send Email". Thank you!
 
@luni - it is probably on me for not doing some rtfm or even watching the fabulous video .... WTFV I saw linked.

I updated my VSCode and downloaded your latest to replace the stuff I got 'way back' {9/23/2018}.

So I ran current VisualTeensy - presented with a wonderful dialog to update - did some obvious stuff - pointed it to an existing sketch that ended up named to a new project I wanted separate place, but the sketch didn't follow. Then poked around to find something that ended up with main.cpp that I never figured out how to build the blink before giving up after I got to a VsCode project?

Also it offers the default Teensy LIB folders - but I didn't see where it wanted to offer to include from my current sketchbook\libraries? That would have been handy as I needed at least one from there as a convert or dual user.
 
I try to explain briefly. (need to work on the documentation, some kind of quick start guide for the impatient might be a good idea :)

To check if everything works correctly I recommend the following simple procedure.

  • Check and adjust required folders in the Settings Tab
  • Generate an empty folder somewhere, name it whatever you like (well, spaces are never a good idea...)
  • Open this folder in VisualTeensy (File|Open), choose the settings you need in VisualTeensy (Board etc...)
  • Do a File Save to generate the Project

From this point on you don't need VisualTeensy anymore and can close it if you like.

The procedure above should generate all required jsons, including a simple main.cpp containing code to blink the LED. It should also open vsCode and show the generated main.cpp. CTRL+SHIFT+B should open the build menu with the obvious entries. If you choose Build it just builds, if you choose upload the build is followed by an upload. It should give you upload options for TyCommander and Teensy.exe if configured in the Setup Tab.
 
That seems about right - I should have found 'instructions for the impatient' or Lazy :)

I had VSCode open - but knowing when I was done with VTeensy is where I got lost knowing to close it and move on. And when I did the choice to build wasn't clear - maybe because VSCode was already open ? - so I couldn't get a blink to work.

Also knowing I needed to see my sketchbook\libraries folder to include something kept me looking - and if I really had to browse for it.

The steps made me think it would import my prior sketch folder and I was sad just seeing main.cpp after I did that. With the IDE ( or SublimeText ) I can go into any of 2,100 prior sketch folders and build ( for sublime I might need to run the TSET batch file to build a batch file and answer 5 prompted 'choices' that mirror the IDE Boards entries { For T_4.0 it is : 6,1,1,1,y :: and then Build } ) That puts this in the batch file to run the IDE builder form CMDline:
Code:
set model=teensy40
set speed=600
set opt=o2std
set usb=serial
That triggers the IDE to build and then uploads with TeensyLoader or TyComm if 'integrated'.

Change takes effort - especially changing editor commands { Code Format :: Ctrl+T in IDE I set to Ctrl+Alt+F in sublime and now Alt+Shift+F for VSCode ... or was it Ctrl+... :) )

One thing my 1992 "Work" Editor had was FOLDER Search - Sublime does that with Ctrl+Shift+F for global find ( for any directory tree ) versus Ctrl+F for Find of Ctrl+'F3' for find what is under the cursor. That is critical to parsing the Teensy CORES + Libraries or even finding something in once written in 2100 sketches, or sketchbook\libraries. Does VSCode have such a Global Search?

VisualTeensy has evolved really well from those first posts long ago - impressive work!
 
Need to leave, quick note: there is a build system setting. Change from makefile to builder then you can use standard .ino sketches
 
Need to leave, quick note: there is a build system setting. Change from makefile to builder then you can use standard .ino sketches

Seems I did that - maybe why the main.cpp file wouldn't build BLINK then as I changed it AFTER creating it - and my assuming I had told it to 'import' the prior sketch.

I ended up with having to choose a complier 'gcc variant?' too for some reason at one point?

Again - mostly on me expecting it to just work without having read or watched anything. That is one thing the IDE does - it just sort of works to build examples.
 
Again - mostly on me expecting it to just work without having read or watched anything. That is one thing the IDE does - it just sort of works to build examples.
That's true of course and this obviously is the reason why Arduino was and is such a game changer. It enables people having absolutely no experience with microcontrollers to be up and running in minutes. But for me it quickly felt like using training wheels on a bicycle. Nice to learn but a nuisance if you know how to ride a bike.

VisualTeensy was never meant to be a replacement of the Arduino IDE. It uses a standard c++ build environment without the 'conveniences' of a one click solution. It tries to make setting up such projects as easy as possible but it does not try to hide away the complexity of developing in c++ and it tries to give the user full control over the build process. I'm meanwhile using it on a daily basis and only go back to the Arduino IDE if I need to check if something compiles for others without issue. Of course, there are a lot of other alternatives to the Arduino IDE. Platform.io seems to get better and better all the time but so far I didn't find a solution NOT using the builder but providing a standard c++ environment and a state of the art IDE.

Anyway, the documentation was kind of a hack indeed. I tried to make it clearer and added a few standard workflows (to be extended). Hope the usage and idea of it gets clearer now. Here a link to the revised readme: https://github.com/luni64/VisualTeensy#visualteensy

One thing my 1992 "Work" Editor had was FOLDER Search - Sublime does that with Ctrl+Shift+F for global find ( for any directory tree ) versus Ctrl+F for Find of Ctrl+'F3' for find what is under the cursor. That is critical to parsing the Teensy CORES + Libraries or even finding something in once written in 2100 sketches, or sketchbook\libraries. Does VSCode have such a Global Search?

I don't know but I assume yes. There is a myriad of extensions to vsCode. I would be surprised if there wouldn't be one with this feature. To parse the Teensy Cores (or any other lib) to me F12 is much more convenient. It directly jumps to right place. E.g. place the cursor in pinMode, hit F12 and you directly land here:

Code:
void pinMode(uint8_t pin, uint8_t mode)
{
	const struct digital_pin_bitband_and_config_table_struct *p;

	if (pin >= CORE_NUM_DIGITAL) return;
	p = digital_pin_to_info_PGM + pin;
	if (mode == OUTPUT || mode == OUTPUT_OPENDRAIN) {
		*(p->reg + 1) |= p->mask; // TODO: atomic
	.....

... hit ALT + LEFT brings you back to where you were... (very convenient)

So, a lot of choices for a lot of people with a lot of needs. The more the better I would say...
 
Good to have updated doc and notes. Will give it a look.

Reading your post led me to look at : code.visualstudio.com/docs/editor/multi-root-workspaces
So adding this folder should allow reference - if it wasn't already there: T:\arduino-1.8.12\hardware\teensy\avr
> But has to save as a project to save those settings - not just in place as created?

Went back and Ctrl+Shift+B did build a hex - but had wrong Teensy.
> Opened VisualTeensy and changed - it saw existing project - but ended up with main.ccp and src\main.cpp as VSCode was already opened and it opened again. So it seems VSCode has to be closed to change the build directives?
- build failed for multiples setup()'s - wasn't sure which main.cpp to delete.
- this was because I pointed to an existing sketchbook folder during setup - but then saved to a NEW VisualTeensy Folder as I didn't want to corrupt my sketch folder.
> looks like it got confused last night and made main.cpp instead of an INO for my BUILDER based project? and today it did a non Builder setup with src\main.cpp?
- A VSCode VisualTeensy 'Add In' for board/build params would be nice for on the fly board changes like in the IDE.

I just got faster ISP service so UPDATES to VSCode aren't as scary long and I wanted to test that quickly to confirm my system was working better. It is - the update from JUNE 2019 to Jan 2020 VSCode went quickly!

I'll give it a try when I have more time - I hoped to just update and see VSCode and VisualTeensy work. But a few things going on with current machine setup messed with it.

notes Reading the README.md:
> should add 'install TyCommander' link and notes as it is required? Perhaps it uses Teensy.exe if path not given?
> VERY NICE to note 'spaces are bad'
> Based on above it seems VSCode should be closed if the project is to be edited with VisualTeensy?
> The readme is Windows based ( great for use here) - does this work on MAC/Linux with VisualTeensy?

The readme looks good - if I followed it instead of trying to preserve my existing setup at the same time - confusing both VisualTeensy and myself.
 
Hi Luni,
I am impressed by what you are doing with VisualTeensy. I think it fills an important need. Because I use Ubuntu Linux I am unable to use it. I tried to run it under Wine but that did not work. It would be really nice if you produced a platform agnostic version written in, for example, Python. Mac users would be grateful!

As an aside, I read your blog article about your unfortunate encounter with copyright law. I thought your summary was very useful. People, like myself, ensconced in the open source world, have a paradoxical relationship with copyright law. On the one hand we desire as much openness and sharing as possible, in the belief that the stimulus to society far outweighs losses to individuals or organisations. On the other hand, copyright law(copyleft) is necessary for the orderly function of the opensource world. The GPL and Creative Commons licenses are good examples of this. The genius of Richard Stallman was to recognise this.
 
Hi Luni,
I am impressed by what you are doing with VisualTeensy. I think it fills an important need. Because I use Ubuntu Linux I am unable to use it. I tried to run it under Wine but that did not work. It would be really nice if you produced a platform agnostic version written in, for example, Python. Mac users would be grateful!

It is not very likely that I'll rewrite this anytime soon in a platform agnostic way (I simply won't find enough time for this) but finding out why it doesn't work with Wine might be doable some time. Currently I have the following roadmap (mainly based on my personal needs and user input)

  • Library Mode Add a library mode which will setup library projects. I.e. projects compatible with the Arduino 1.5 library structure. This will be tricky since in such a project you don't have a 'main' sketch which can be used for the development. It will also need to be able to build from the examples and provide some means to choose the 'active' example.
  • Multi Configuration Capability: Add a possibility to setup a project which will build different configurations at once. E.g. different boards, different Speeds or different versions of Teensyduino / compiler etc. This is mainly useful for testing code to be published.
  • User defined files Enable user defined files to be copied to the project folder. E.g. .gitignore. .clang-format etc.
  • Clone current core Directly clone the current teensyduino core to the project. This makes testing new features much easier, if possible extend for checking out core pull-requests as well.
  • Colored Editor Add support to change some project based accent colors to vsCode. During multi Teensy development (e.g. client server) it is often confusing to identify the corresponding editor in the title bar, visual identification (color) is quicker.

As an aside, I read your blog article about your unfortunate encounter with copyright law. I thought your summary was very useful. People, like myself, ensconced in the open source world, have a paradoxical relationship with copyright law. On the one hand we desire as much openness and sharing as possible, in the belief that the stimulus to society far outweighs losses to individuals or organisations. On the other hand, copyright law(copyleft) is necessary for the orderly function of the opensource world. The GPL and Creative Commons licenses are good examples of this. The genius of Richard Stallman was to recognise this.
This must be another luni. Never had any copyright issues - at least I don't know of any :))
 
Last edited:
in case someone wants to compile ino fies with makefile, here is my added rule to a VisualTeensy derived makefile
Code:
USR_INO_FILES  := $(call rwildcard,$(USR_SRC)/,*.ino)
USR_OBJ        += $(USR_INO_FILES:$(USR_SRC)/%.ino=$(USR_BIN)/%.o)
and
Code:
$(USR_BIN)/%.o: $(USR_SRC)/%.ino
	@echo $(COL_SRC)USER [INO] $< $(COL_ERR)
	@"$(CC)" $(CPP_FLAGS) $(INCLUDE) -x c++ -o $@ -c $< -x none
obviously, in this case the ino file must comply to standard c++

not sure if worthwhile to include to VisualTeensy.
 
I didn't add this because, as you mention, a normal *ino won't compile unless it complies to the usual c++ rules. Users probably stumble over forward declaration issues quickly. But if there is a need, I can certainly add an option with the corresponding warning.
 
Currently I have the following roadmap (mainly based on my personal needs)

I could find it interesting to create a complete standalone development system (not only core, but also all the libraries) so there are no multiple dependency issues.
 
I could find it interesting to create a complete standalone development system (not only core, but also all the libraries) so there are no multiple dependency issues.

Do you mean to detect the dependencies automatically or just copying the libs to the project? The first might be difficult (need to parse the headers) the second should already be possible (well, nearly): All libraries from the Teensyduino repo and from the huge Arduino repo are already copied to the project by default. Shared libraries (those from sketchdirectory/libraries) are only linked. Having a 'copy anyway button' for those, or a general option might be useful indeed. I'll add that to the roadmap on GitHub https://github.com/luni64/VisualTeensy/projects/1
 
Yes, I mean 'copy anyway button' for selected libraries including "sketchdirectory/libraries" and cores
I'm aiming at minimal workspace containing all source code I need to compile the program.
 
Yes, I mean 'copy anyway button' for selected libraries including "sketchdirectory/libraries" and cores
I'm aiming at minimal workspace containing all source code I need to compile the program.

Yes, this will be a very useful capability. Imagine this scenario. I am developing a system on my favourite, powerful workstation. But then I need to visit the client to show him work in progress and discuss some options. With this facility I would copy the minimal but complete system to a laptop, visit the client, show him the progress, make suggested changes and return to my office. Here I would load the modified system back onto the workstation where I could continue development. Of course I can already do this manually but a one button does it all solution would be rather useful.
 
Yes, this will be a very useful capability. Imagine this scenario. I am developing a system on my favourite, powerful workstation. But then I need to visit the client to show him work in progress and discuss some options. With this facility I would copy the minimal but complete system to a laptop, visit the client, show him the progress, make suggested changes and return to my office. Here I would load the modified system back onto the workstation where I could continue development. Of course I can already do this manually but a one button does it all solution would be rather useful.

That was I had in mind.
 
I have an idea to make VisualTeensy multiplatform

why not create a plugin for vscode out of visual teensy

Then Paul @ PJRC only need to have a TeensyDuino installer that don't require that Arduino Is installed

And voila we can use Teensy in a professional environment without to much hassle.


edit.
If I integrate it into my existing VSCODE plugin (that is used by the Design Tool)
Then it can both be generated by the tool (if one want to have that as the dev base)
Or by a page inside VSCODE for those that want to all the coding in VSCODE or
are just developing non Audio Projects
 
Back
Top