Java Access to EXT Connector

I am creating a new Hat and need to connect to the EXT connector. I was successfully able to control the pins in C++ but I am not having luck with Java.

Whenever I startup with a EXT pin I get only noise and the screen ie the app has crashed it seems

I found 1 example on the forum which used PIN17 (before finding it again the FemtoIDE help ) and this actually worked ie did not crash immediately. But other pins like PIN8,10,11 (The SPI Pins ) crashed even when they are just included. ie even before they are executed.

     if( System.currentTimeMillis() > 10000){
                 PIN8.pullUp();   //Leaving this uncommented crashes on startup
                 PIN8.setInput(); //Leaving this uncommented crashes on startup
        }else{
                PIN17.pullUp(); //This works ok
                PIN17.setInput(); //This works ok
        }

I am using the standard Java Game (the dog) in FemtoIDE ( 1.0.0 ) and adding just the above code ( and include)

If PIN8 is used in the code it crashes.

Anyone care to reproduce this or have any idea’s how to access the EXT via java.

Thanks.

2 Likes

Hey,
I remember some pins weren’t correctly configured by the lib (I think it was @HomineLudens who reported it, at the time?) but since there wasn’t much interest in using Java with the EXT and cross-referencing the flags with the docs is a chore, it ended up never getting fixed.

Edit: found the issue on github.

2 Likes

I am pretty sure if you look in Canabalto source code you will find something, i remember we made it so that you can connect an external button using the PEX. I know i tried it amd it was working

2 Likes

Yup I can confirm, some of the PEX I/O are not mapped correctly or either can crash.
I’ve used PIN17 and PIN4 for Canabalto’s inputs.

1 Like

Does the Java Compiler pull from the EXT.java source code file directly or does it need to be built in some way.

ie if I make changes directly to the EXT.java in the source tree to try to hack a fix is that possible or do I need to build it into some package with some toolchain

It pulls from the source code, but the IDE caches it and needs a restart for the changes to have any effect. Alternatively, you could copy the file into your project and make the changes there. Once its working you can copy it back over the original.