ardublock icon indicating copy to clipboard operation
ardublock copied to clipboard

Add support for Guino

Open taweili opened this issue 11 years ago • 18 comments

http://www.instructables.com/id/Guino-Dashboard-for-your-Arduino/?ALLSTEPS

taweili avatar Nov 17 '14 02:11 taweili

i ve add the function for make :+1: - a graph

  • a slider (virtual potentiometre)

i ve make a block guino_init because i need : GUINO_GERER_INTERFACE();

at the start of void loop without a block, i don t know how to put some code at the start of the void loop. thanks for help on this point

karlTH avatar Nov 23 '14 20:11 karlTH

Why you don't put this in void setup? Em 23/11/2014 18:24, "THOMAS karl" [email protected] escreveu:

i ve add the function for make [image: :+1:] - a graph

  • a slider (virtual potentiometre)

i ve make a block guino_init because i need : GUINO_GERER_INTERFACE();

at the start of void loop without a block, i don t know how to put some code at the start of the void loop. thanks for help on this point

— Reply to this email directly or view it on GitHub https://github.com/taweili/ardublock/issues/123#issuecomment-64133025.

danielfsc avatar Nov 23 '14 21:11 danielfsc

my friend look the librairie of guino he try to put it in the setup.

i ve an other mistake in the class guino_read the variable isn't incremental. i don't understand why ?

some idee ? thanks

karlTH avatar Nov 24 '14 10:11 karlTH

Did you try the code > loop block?

2014-11-24 8:15 GMT-02:00 THOMAS karl [email protected]:

my friend look the librairie of guino he try to put it in the setup.

i ve an other mistake in the class guino_read the variable isn't incremental. i don't understand why ?

some idee ? thanks

— Reply to this email directly or view it on GitHub https://github.com/taweili/ardublock/issues/123#issuecomment-64173529.

Dr. Daniel Girardi Universidade Federal de Santa Catarina - Campus Blumenau Rua Pomerode, 710 Salto do Norte - Blumenau - SC 89065-300

danielfsc avatar Nov 24 '14 11:11 danielfsc

how did youuse it loop block ?

karlTH avatar Nov 24 '14 11:11 karlTH

Check this out. My version is different from oficial but you can build this in your version.

2014-11-24 9:39 GMT-02:00 THOMAS karl [email protected]:

how did youuse it loop block ?

— Reply to this email directly or view it on GitHub https://github.com/taweili/ardublock/issues/123#issuecomment-64181758.

Dr. Daniel Girardi Universidade Federal de Santa Catarina - Campus Blumenau Rua Pomerode, 710 Salto do Norte - Blumenau - SC 89065-300

danielfsc avatar Nov 24 '14 11:11 danielfsc

thanks i will try something in the loop block very good idea and i will tell you

i ve a bug in the creation of a variable. the name is always _ABVAR_1_Guinotracegraphique if i put a second block in ardubloc the arduino code generation is still _ABVAR_1_Guinotracegraphique, i ve never _ABVAR_2_Guinotracegraphique

i ve a bug on the incremental this is the class any idea ??

package com.ardublock.translator.block.Duinoedu;

import com.ardublock.translator.Translator; import com.ardublock.translator.block.TranslatorBlock; import com.ardublock.translator.block.exception.SocketNullException; import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class Guino_Read extends TranslatorBlock {

public Guino_Read (Long blockId, Translator translator, String codePrefix, String codeSuffix, String label)
{
    super(blockId, translator, codePrefix, codeSuffix, label);
}

//@Override
    public String toCode() throws SocketNullException, SubroutineNotDeclaredException
    {

        String Title;
        String Variable;
        String Min;
        String Max;
        TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
        Title = translatorBlock.toCode();
        translatorBlock = this.getRequiredTranslatorBlockAtSocket(1);
        Variable = translatorBlock.toCode();
        translatorBlock = this.getRequiredTranslatorBlockAtSocket(2);
        Min = translatorBlock.toCode();
        translatorBlock = this.getRequiredTranslatorBlockAtSocket(3);
        Max = translatorBlock.toCode();

        String internalVariableName = translator.getNumberVariable(label);
        if (internalVariableName == null)
        {
            internalVariableName = translator.buildVariableName(label);
            translator.addNumberVariable(label, internalVariableName);
            translator.addDefinitionCommand("int " + internalVariableName + " = 0 ;");

// translator.addSetupCommand(internalVariableName + " = 0;"); }

        translator.addHeaderFile("EasyTransfer.h");
        translator.addHeaderFile("EEPROM.h");
        translator.addHeaderFile("Guino.h");
        translator.addDefinitionCommand("//libraries at http://duinoedu.com/dl/lib/dupont/EDU_Guino/");
        translator.addSetupCommand("GUINO_BRANCHER();");
        translator.addGuinoCommand("GUINO_AFFICHER_GRAPH("+Title+","+internalVariableName+","+Min+","+Max+");\nGUINO_AFFICHER_LIGNE(); ");


        String ret =    internalVariableName+"="+Variable+";\n"+
                        "GUINO_LIRE("+internalVariableName+");\n";
        return  ret ;

    }

}

karlTH avatar Nov 24 '14 12:11 karlTH

Send your .abp, please.

2014-11-24 10:04 GMT-02:00 THOMAS karl [email protected]:

thanks i will try something in the loop block very good idea and i will tell you

i ve a bug in the creation of a variable. the name is always _ABVAR_1_Guinotracegraphique if i put a second block in ardubloc the arduino code generation is still _ABVAR_1_Guinotracegraphique, i ve never _ABVAR_2_Guinotracegraphique

i ve a bug on the incremental this is the class any idea ??

package com.ardublock.translator.block.Duinoedu;

import com.ardublock.translator.Translator; import com.ardublock.translator.block.TranslatorBlock; import com.ardublock.translator.block.exception.SocketNullException; import com.ardublock.translator.block.exception.SubroutineNotDeclaredException;

public class Guino_Read extends TranslatorBlock {

public Guino_Read (Long blockId, Translator translator, String codePrefix, String codeSuffix, String label) { super(blockId, translator, codePrefix, codeSuffix, label); }

//@Override public String toCode() throws SocketNullException, SubroutineNotDeclaredException {

    String Title;
    String Variable;
    String Min;
    String Max;
    TranslatorBlock translatorBlock = this.getRequiredTranslatorBlockAtSocket(0);
    Title = translatorBlock.toCode();
    translatorBlock = this.getRequiredTranslatorBlockAtSocket(1);
    Variable = translatorBlock.toCode();
    translatorBlock = this.getRequiredTranslatorBlockAtSocket(2);
    Min = translatorBlock.toCode();
    translatorBlock = this.getRequiredTranslatorBlockAtSocket(3);
    Max = translatorBlock.toCode();

    String internalVariableName = translator.getNumberVariable(label);
    if (internalVariableName == null)
    {
        internalVariableName = translator.buildVariableName(label);
        translator.addNumberVariable(label, internalVariableName);
        translator.addDefinitionCommand("int " + internalVariableName + " = 0 ;");

// translator.addSetupCommand(internalVariableName + " = 0;"); }

    translator.addHeaderFile("EasyTransfer.h");
    translator.addHeaderFile("EEPROM.h");
    translator.addHeaderFile("Guino.h");
    translator.addDefinitionCommand("//libraries at http://duinoedu.com/dl/lib/dupont/EDU_Guino/");
    translator.addSetupCommand("GUINO_BRANCHER();");
    translator.addGuinoCommand("GUINO_AFFICHER_GRAPH("+Title+","+internalVariableName+","+Min+","+Max+");\nGUINO_AFFICHER_LIGNE(); ");


    String ret =    internalVariableName+"="+Variable+";\n"+
                    "GUINO_LIRE("+internalVariableName+");\n";
    return  ret ;

}

}

— Reply to this email directly or view it on GitHub https://github.com/taweili/ardublock/issues/123#issuecomment-64185073.

Dr. Daniel Girardi Universidade Federal de Santa Catarina - Campus Blumenau Rua Pomerode, 710 Salto do Norte - Blumenau - SC 89065-300

danielfsc avatar Nov 24 '14 12:11 danielfsc

here is the abp in text mode

http://pastebin.com/dTg2mNnB

copy and past save as .abp

karlTH avatar Nov 24 '14 12:11 karlTH

Well, I don't have your guino blocks. Can you send your ardublock.jar?

2014-11-24 10:12 GMT-02:00 THOMAS karl [email protected]:

here is the .abp in text mod from my version no incremental for guino_read and guino_slider

437 309

1023

605 381

0

605 357

3

605 333

Pot2

605 309

437 135

1023

605 207

0

605 183

3

605 159

Pot1

605 135

graph1

437 111

199 282

411

1023

437 429

0

437 405

Graph2

437 285

199 108

398 416

1023

437 255

0

437 231

100 100

/cb:CODEBLOCKS

— Reply to this email directly or view it on GitHub https://github.com/taweili/ardublock/issues/123#issuecomment-64185769.

Dr. Daniel Girardi Universidade Federal de Santa Catarina - Campus Blumenau Rua Pomerode, 710 Salto do Norte - Blumenau - SC 89065-300

danielfsc avatar Nov 24 '14 12:11 danielfsc

https://drive.google.com/file/d/0ByqtNDjRdc-fSE9ObjRjRXRwRk0/view?usp=sharing here my jar

karlTH avatar Nov 24 '14 12:11 karlTH

I'm not sure if that is the problem but when you use the Guino Slider block to create a variable it try to create a variable with same name. Try to create a variable with different name. I'm run out of time to help you now, but send your source and tomorrow I will look that for you.

2014-11-24 10:27 GMT-02:00 THOMAS karl [email protected]:

https://drive.google.com/file/d/0ByqtNDjRdc-fSE9ObjRjRXRwRk0/view?usp=sharing here my jar

— Reply to this email directly or view it on GitHub https://github.com/taweili/ardublock/issues/123#issuecomment-64187140.

Dr. Daniel Girardi Universidade Federal de Santa Catarina - Campus Blumenau Rua Pomerode, 710 Salto do Norte - Blumenau - SC 89065-300

danielfsc avatar Nov 24 '14 13:11 danielfsc

super thanks a lot here are my source. i ve also start to mofifie loopblock, translator.java and GenerateCodeButtonListener.java i want the code "GUINO_GERER_INTERFACE();" appear at the start of loop if there is a guino block like scoop but i forget something

here are the source https://drive.google.com/file/d/0ByqtNDjRdc-fNk82cVJjRVpPNk0/view?usp=sharing

karlTH avatar Nov 24 '14 13:11 karlTH

Look if this solve your problem: On lines 32, 35 e 36 I change the variable label by Title.

2014-11-24 11:10 GMT-02:00 THOMAS karl [email protected]:

super thanks a lot here are my source. i ve also start to mofifie loopblock, translator.java and GenerateCodeButtonListener.java i want the code "GUINO_GERER_INTERFACE();" appear at the start of loop if there is a guino block like scoop but i forget something

here are the source

https://drive.google.com/file/d/0ByqtNDjRdc-fNk82cVJjRVpPNk0/view?usp=sharing

— Reply to this email directly or view it on GitHub https://github.com/taweili/ardublock/issues/123#issuecomment-64191431.

Dr. Daniel Girardi Universidade Federal de Santa Catarina - Campus Blumenau Rua Pomerode, 710 Salto do Norte - Blumenau - SC 89065-300

danielfsc avatar Nov 25 '14 13:11 danielfsc

thanks it works very well

please could you also take a look for the loop block ? i want the code "GUINO_GERER_INTERFACE();" appear at the start of loop if there is a guino block but i forget something

karlTH avatar Nov 25 '14 15:11 karlTH

I don't read the documentation of guino but I believe that this function should be called before you use other guino functions. There is no problem use a analogRead/Write before you call Guino_gerer_interface(). Try that.

2014-11-25 13:35 GMT-02:00 THOMAS karl [email protected]:

thanks it works very well

please could you also take a look for the loop block ? i want the code "GUINO_GERER_INTERFACE();" appear at the start of loop if there is a guino block but i forget something

— Reply to this email directly or view it on GitHub https://github.com/taweili/ardublock/issues/123#issuecomment-64417824.

Dr. Daniel Girardi Universidade Federal de Santa Catarina - Campus Blumenau Rua Pomerode, 710 Salto do Norte - Blumenau - SC 89065-300

danielfsc avatar Nov 25 '14 16:11 danielfsc

i ve modifie loopblock i ve had this if (translator.isGuinoProgram()) { ret += "GUINO_GERER_INTERFACE();\n"; }

i ve modifie , translator.java and GenerateCodeButtonListener.java but ret += "GUINO_GERER_INTERFACE();\n"; never appear i don t understand why. there is a bug could you help me ? i ve try with analogRead/Write in .abp but nothing append.

karlTH avatar Nov 25 '14 17:11 karlTH

i find the mistake

before

if (!block.hasPlug() && (Block.NULL.equals(block.getBeforeBlockID())))

i put this if (block.getGenusName().equals("DuinoEDU_Guino_Read")) { translator.setGuinoProgram(true);

        }
        if (block.getGenusName().equals("DuinoEDU_Guino_Title"))
        {
            translator.setGuinoProgram(true);

        }
        if (block.getGenusName().equals("DuinoEDU_Guino_Slider"))
        {
            translator.setGuinoProgram(true);

        }

karlTH avatar Nov 25 '14 22:11 karlTH