Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jarduino witht Arduino Mega #43

Open
frickerm opened this issue Dec 10, 2015 · 14 comments
Open

Jarduino witht Arduino Mega #43

frickerm opened this issue Dec 10, 2015 · 14 comments

Comments

@frickerm
Copy link

Hey there
I want to use Jarduino with an Arduino Mega
because i need more digital output pin

but if i enter PIN_33 Output for example there is an error
because they dont know the variable PIN_33

Can i extends the source code and how can i do this

@frickerm
Copy link
Author

Ok thank you
I found and change the JArduino.h file
but i don´t can find the DigialPin.java
where was there saved

@brice-morin
Copy link
Contributor

Not sure I understood... but if you are looking for the DigitalPin.java file, you can just click the link https://github.com/SINTEF-9012/JArduino/blob/master/jarduino.core/src/main/java/org/sintef/jarduino/DigitalPin.java

@frickerm
Copy link
Author

Okay
I downloaded the JArduino 0.1.7b because i has Updatet my Arduino Software
then i copy the firmware in the sample folder of the Arduino softwar
now i load the other files of the dowload in my java Ide (eclipse)

the import DigitalPin works
but i dont know where does the import saved
and where can i change

@frickerm
Copy link
Author

I found them on lib
but there are all class files how can i change them now

@brice-morin
Copy link
Contributor

Maybe the easiest is to start from the source, by cloning this repo.

@frickerm
Copy link
Author

okay now i changed the class file

to this

/**

  • Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, Version 3, 29 June 2007;
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at
    *
  • http://www.gnu.org/licenses/lgpl-3.0.txt
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.
    *
  • Authors: Franck Fleurey and Brice Morin
  • Company: SINTEF IKT, Oslo, Norway
  • Date: 2011
    */
    package org.sintef.jarduino;

import java.util.HashMap;
import java.util.Map;

public enum DigitalPin
{
PIN_0((byte)0),
PIN_1((byte)1),
PIN_2((byte)2),
PIN_3((byte)3),
PIN_4((byte)4),
PIN_5((byte)5),
PIN_6((byte)6),
PIN_7((byte)7),
PIN_8((byte)8),
PIN_9((byte)9),
PIN_10((byte)10),
PIN_11((byte)11),
PIN_12((byte)12),
PIN_13((byte)13),
A_0((byte)14),
A_1((byte)15),
A_2((byte)16),
A_3((byte)17),
A_4((byte)18),
A_5((byte)19);
PIN_22((byte)22),
PIN_23((byte)23),
PIN_24((byte)24),
PIN_25((byte)25),
PIN_26((byte)26),
PIN_27((byte)27),
PIN_28((byte)28),
PIN_29((byte)29),
PIN_30((byte)30),
PIN_31((byte)31),
PIN_32((byte)32),
PIN_33((byte)33),
PIN_34((byte)34),
PIN_35((byte)35),
PIN_36((byte)36),
PIN_37((byte)37),
PIN_38((byte)38),
PIN_39((byte)39),
PIN_40((byte)40);

private final byte value;

private DigitalPin(byte value)

{
this.value = value;
}

public byte getValue()

{
return value;
}

private static final Map<Byte, DigitalPin> map;

static {
    map = new HashMap<Byte, DigitalPin>();
    map.put((byte)0, DigitalPin.PIN_0);
    map.put((byte)1, DigitalPin.PIN_1);
    map.put((byte)2, DigitalPin.PIN_2);
    map.put((byte)3, DigitalPin.PIN_3);
    map.put((byte)4, DigitalPin.PIN_4);
    map.put((byte)5, DigitalPin.PIN_5);
    map.put((byte)6, DigitalPin.PIN_6);
    map.put((byte)7, DigitalPin.PIN_7);
    map.put((byte)8, DigitalPin.PIN_8);
    map.put((byte)9, DigitalPin.PIN_9);
    map.put((byte)10, DigitalPin.PIN_10);
    map.put((byte)11, DigitalPin.PIN_11);
    map.put((byte)12, DigitalPin.PIN_12);
    map.put((byte)13, DigitalPin.PIN_13);

    map.put((byte)22, DigitalPin.PIN_22);
    map.put((byte)23, DigitalPin.PIN_23);
    map.put((byte)24, DigitalPin.PIN_24);
    map.put((byte)25, DigitalPin.PIN_25);
    map.put((byte)26, DigitalPin.PIN_26);
    map.put((byte)27, DigitalPin.PIN_27);
    map.put((byte)28, DigitalPin.PIN_28);
    map.put((byte)29, DigitalPin.PIN_29);
    map.put((byte)30, DigitalPin.PIN_30);
    map.put((byte)31, DigitalPin.PIN_31);
    map.put((byte)32, DigitalPin.PIN_32);
    map.put((byte)33, DigitalPin.PIN_33);
    map.put((byte)34, DigitalPin.PIN_34);
    map.put((byte)35, DigitalPin.PIN_35);
    map.put((byte)36, DigitalPin.PIN_36);
    map.put((byte)37, DigitalPin.PIN_37);
    map.put((byte)38, DigitalPin.PIN_38);
    map.put((byte)39, DigitalPin.PIN_39);
    map.put((byte)40, DigitalPin.PIN_40);

    map.put((byte)14, DigitalPin.A_0);
    map.put((byte)15, DigitalPin.A_1);
    map.put((byte)16, DigitalPin.A_2);
    map.put((byte)17, DigitalPin.A_3);
    map.put((byte)18, DigitalPin.A_4);
    map.put((byte)19, DigitalPin.A_5);
}

public static DigitalPin fromValue(byte b) {
    return map.get(b);
}

}

but eclipse dont fint PIN_40 for example

@frickerm
Copy link
Author

or can you send me the chanced import jar files via email

[email protected]

@brice-morin
Copy link
Contributor

You can regenerate the jars with Maven. man clean install

@frickerm
Copy link
Author

Ok
i dont know what i should change

did someone else changed this and could send me
please

@frickerm
Copy link
Author

when i copy the changed DigitalPin class file in the jar file (imports)

should i certify the class file

because if i open the class files with an editor there are all encoded
and the changed is readable

@brice-morin
Copy link
Contributor

I would not recommend changing the content of .jar files by copy/pasting modified .class files.

  • install Maven
  • modify the sources as you did
  • run mvn clean install at the root

@frickerm
Copy link
Author

sorry but it dosent work

@ScottBruton
Copy link

Guys, I really want to extend jArduino to work with Arduino Mega.
I tried understanding the above threads but I'm still unsure what to do to do this.

Please can someone tell me step by step how to change jArduino files to be able to include all Analog Pins ( A0 - A15) and Digital pins (D22-D53).

Thats all I need.

Thank you
Scott

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants