Loading Arduino sketches

Discussion in 'UDOO NEO' started by ddewaele, Dec 6, 2015.

  1. ddewaele

    ddewaele Member

    Joined:
    Dec 2, 2014
    Messages:
    48
    Likes Received:
    11
    Hi,

    I'm running the Neo in a headless mode and would like to be able to upload Arduino sketches.
    I pulled the latest udoo-web-conf from Github and noticed it contained an online Arduino editor allowing you to upload sketches straight from the web.onto the neo.

    I noticed that the udoo-web-conf app is having the udooer user execute the following command:

    Code:
    udooer@udooneo:~$ export DISPLAY=:0 && /usr/bin/arduino --upload /opt/udoo-web-conf/mysketch/mysketch.ino
    Picked up JAVA_TOOL_OPTIONS:
    Loading configuration...
    Initializing packages...
    Preparing boards...
    Verifying and uploading...
    
    Sketch uses 43,148 bytes (8%) of program storage space. Maximum is 524,288 bytes.
    cp: cannot create regular file ‘/var/opt/m4/m4last.fw’: Permission denied
    Error copying last bin
    Depsite the last error this seems to work fine. The Arduino script launches a java class that in turns launches some avr binaries to compile the ino and flash the mcu.

    I did however notice that
    • This only works for the udooer user (my own personal user on the device cannot execute this)
    • This only works (believe it or not) when the file is called /opt/udoo-web-conf/mysketch/mysketch.ino
    What would I need to setup so that any user can do this, and that I'm not limited to using "/opt/udoo-web-conf/mysketch/mysketch.ino".

    Running compiled ino files (bin files) works well for all users on the device
    Code:
    /usr/bin/udooneo-m4uploader /opt/udoo-web-conf/arduino_examples/Blink.cpp.bin
     
  2. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Dear @ddewaele,
    or maybe I should call your Sherlock! You discovered what we are working on, among the other things! It will be released soon, be patient in the meanwhile :p
     
    ddewaele likes this.
  3. ddewaele

    ddewaele Member

    Joined:
    Dec 2, 2014
    Messages:
    48
    Likes Received:
    11
    hehe ... a little bird told me I could fine the neo kernel there.

    I can confirm that on the beta5 image (that can be downloaded as an image from the website) I don't have this delay issue, but there the /dev/ttyMCC is not working at all.
    Is this expected behaviour for the beta5 release ?

    I need to be able to read analog voltages, is there an alternative way of doing that (without using Arduino analogRead) ? If you can point me in a direction that would be great.

     
  4. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Why don't you want to use analogRead?
     
  5. ddewaele

    ddewaele Member

    Joined:
    Dec 2, 2014
    Messages:
    48
    Likes Received:
    11
    Well, given the current situation where
    • with the beta v5 image it's not working (no output on /dev/ttyMCC)
    • with the new kernel there is serial output but it's not stable
    I was wondering what the best approach would be at the moment.
    Please confirm if this is expected behaviour. Should /dev/ttyMCC work on the beta v5 image ? (I simply downloaded the image, put it on an SD, booted my neo and uploaded a blink sketch with a Serial.begin(9600) and Serial.println("LED ON/OFF")'
     
  6. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Dear @ddewaele,
    it works. How do you read the serial?
     
  7. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    You can access ADC via A9.
     
  8. ddewaele

    ddewaele Member

    Joined:
    Dec 2, 2014
    Messages:
    48
    Likes Received:
    11
    ok serial started working after a reboot ... strange....

    but getting the same behaviour where the sketch appears to be running really slow when the serial is not being read.
    As soon as I hook up my Arduino serial monitor the LED blinks every second. (without it its easily 4 seconds).

    The sample sketch I'm running is this one

    Code:
    void setup() {
      Serial.begin(9600);
      // initialize digital pin 13 as an output.
      pinMode(13, OUTPUT);
    }
    
    // the loop function runs over and over again forever
    void loop() {
      Serial.println("HELLO");
      digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
      delay(1000);    // wait for a second
      Serial.println("HELLO2");
      digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
      delay(1000);              // wait for a second
    }
    Is there some more info on accessing the ADC via A9 ? (sample / tutorial / .....) ?
     

Share This Page