Page 1 of 2 12 LastLast
Results 1 to 15 of 23

Thread: PC geek required. Especially if you know what "arduino" means

  1. #1
    Join Date
    21st September 2006 - 21:35
    Bike
    Kawasaki ZX1100 Turbo
    Location
    Auckland
    Posts
    3,100

    PC geek required. Especially if you know what "arduino" means

    Hi all, hoping someone on hear may just so happen to work with Arduino boards and perhaps help me with a little programming in C++ (I think that's right).

    Main problem I get is the program runs but it throws up "cannot find dependent libraries" errors for "Jmyron" (responsible for motion tracking a camera image).
    Anyone able to shed any light please?! !

    (Yes I know it's a bike forum and it's a bit of a blimin long shot, but I've come across KB'ers that work in the most obscure, bizarre and down right awesome places - my money is on at least ONE person on here will see the code below and go... "oooh I know what that means!" and hopefully be able to help!

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------





    */


    // <================================================== =============================================>
    // Begin custom values - change these servo positions and camera dimensions to work with your project
    // <================================================== =============================================>

    public int camWidth = 320; // camera width (pixels), usually 160*n
    public int camHeight = 240; // camera height (pixels), usually 120*n

    public float xMin = 142.0; // 0.0 used for calibration. adjust these numbers to work with
    public float xMax = 47.0; // 180.0 your unique setup.
    public float yMin = 140.0; // 180.0
    public float yMax = 124.0; // 0.0

    // <================================================== =============================================>
    // End custom values
    // <================================================== =============================================>


    int[] diffPixelsColor = {
    255, 255, 0
    }; // Red, green, blue values (0-255) to show pixel as marked as target
    public int effect = 0; // Effect

    public boolean mirrorCam = false; // set true to mirror camera image

    import JMyron.*;
    import blobDetection.*;
    import processing.serial.*;
    import ddf.minim.*;
    import java.awt.Frame;
    import processing.opengl.*; // see note on OpenGL in void setup()
    import procontroll.*;
    import net.java.games.input.*;

    public int minBlobArea = 30; // minimum target size (pixels)
    public int tolerance = 100; // sensitivity to motion

    public boolean runWithoutArduino = false;
    public boolean connecting = false;


    public Serial arduinoPort;
    JMyron camInput;
    BlobDetection target;
    Blob blob;
    Blob biggestBlob;


    int[] Background;
    int[] rawImage;
    int[] rawBackground;
    int[] currFrame;
    int[] screenPixels;
    public int targetX = camWidth/2;
    public int targetY = camHeight/2;
    int fire = 0;
    int[] prevFire = {
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    };

    float xRatio;
    float yRatio;

    int possibleX = camWidth/2;
    int possibleY = camHeight/2;

    int displayX = camWidth/2;
    int displayY = camHeight/2;

    int oldX = camWidth/2; // smoothing (contributed by Adam S.)
    int oldY = camHeight/2; // smoothing
    int xdiff; // smoothing
    int ydiff; // smoothing
    public float smoothingFactor = 0.8; // smoothing
    public boolean activeSmoothing = true;

    String strTargetx;
    String strTargety;
    String fireSelector;
    String scanSelector;


    public boolean showDifferentPixels = false;
    public boolean showTargetBox = true;
    public boolean showCameraView = true;
    public boolean firingMode = true; // true = semi, false = auto
    public boolean safety = true;
    public boolean controlMode = true; // true = autonomous, false = manual
    public boolean soundEffects = true; // set to true to enable sound effects by default
    public boolean scanWhenIdle = true;
    public boolean trackingMotion = true;

    int idleTime = 10000; // how many milliseconds to wait until scanning (when in scan mode)
    int idleBeginTime = 0;
    boolean scan = false;

    public String serPortUsed;

    public int backgroundSet = 0;

    int[][] fireRestrictedZones = new int[30][4];
    int restrictedZone = 1;
    boolean showRestrictedZones = false;

    boolean selectingColor = false;
    boolean trackingColor = false;
    int trackColorTolerance = 100;
    int trackColorRed = 255;
    int trackColorGreen = 255;
    int trackColorBlue = 255;

    boolean selectingSafeColor = false;
    boolean safeColor = false;
    int safeColorMinSize = 500;
    int safeColorTolerance = 100;
    int safeColorRed = 0;
    int safeColorGreen = 255;
    int safeColorBlue = 0;


    public boolean useInputDevice = false; // use a joystick or game controller as input (in manual mode)
    public boolean inputDeviceIsSetup = false;

    public ControllIO controlIO; // more stuff for using a joystick or game controller for input
    public ControllDevice inputDevice;

    public ControllButton[] buttons = new ControllButton[30];
    public ControllSlider[] sliders = new ControllSlider[10];

    public ControllButton[] fire_buttons = new ControllButton[0];
    public ControllButton[] preciseAim_buttons = new ControllButton[0];
    public ControllButton[] centerGun_buttons = new ControllButton[0];
    public ControllButton[] autoOn_buttons = new ControllButton[0];
    public ControllButton[] autoOff_buttons = new ControllButton[0];
    public ControllButton[] inputToggle_buttons = new ControllButton[0];
    public ControllButton[] randomSound_buttons = new ControllButton[0];

    public ControllSlider[] pan_sliders = new ControllSlider[0];
    public ControllSlider[] tilt_sliders = new ControllSlider[0];
    public ControllSlider[] panInvert_sliders = new ControllSlider[0];
    public ControllSlider[] tiltInvert_sliders = new ControllSlider[0];


    public float xPosition = camWidth/2;
    public float yPosition = camHeight/2;


    String[] inStringSplit; // buffer for backup
    int controlMode_i, safety_i, firingMode_i, scanWhenIdle_i, trackingMotion_i, trackingColor_i, leadTarget_i, safeColor_i,
    showRestrictedZones_i, showDifferentPixels_i, showTargetBox_i, showCameraView_i, mirrorCam_i, soundEffects_i;


    void setup() {
    size(camWidth, camHeight); // some users have reported a faster framerate when the code utilizes OpenGL. To try this, comment out this line and uncomment the line below.
    // size(camWidth, camHeight, OPENGL);
    minim = new Minim(this);
    loadSounds();
    playSound(18);
    camInput = new JMyron();
    camInput.start(camWidth, camHeight);
    camInput.findGlobs(0);
    camInput.adaptivity(1.01);
    camInput.update();
    currFrame = camInput.image();
    rawImage = camInput.image();
    Background = camInput.image();
    rawBackground = camInput.image();
    screenPixels = camInput.image();
    target = new BlobDetection(camWidth, camHeight);
    target.setThreshold(0.9);
    target.setPosDiscrimination(true);

    retryArduinoConnect();

    xRatio = (camWidth / (xMax - xMin)); // used to allign sights with crosshairs on PC
    yRatio = (camHeight/ (yMax - yMin)); //
    drawControlPanel();
    }



    void draw() {

    EEPROMbackup();

    if (controlMode) { // autonomous mode
    autonomousMode(); //
    }
    else if (!controlMode) { // manual mode
    manualMode(); //
    }

    if (fire == 1) {
    idleBeginTime = millis();
    scan = false;
    }
    else {
    if (millis() > idleBeginTime + idleTime && controlMode && scanWhenIdle) {
    scan = true;
    }
    else {
    scan = false;
    }
    }

    if (!safety) {
    fire = 0;
    }

    strTargetx = "000" + str(targetX); // make into 3-digit numbers
    strTargetx = strTargetx.substring(strTargetx.length()-3);
    strTargety = "000" + str(targetY);
    strTargety = strTargety.substring(strTargety.length()-3);
    fireSelector = str(0);
    if (firingMode) {
    fireSelector = str(1);
    }
    else {
    fireSelector = str(3);
    }
    if (scan) {
    scanSelector = str(1);
    }
    else {
    scanSelector = str(0);
    }
    //println('a' + strTargetx + strTargety + str(fire) + fireSelector + scanSelector);
    if (!runWithoutArduino && !connecting) {
    arduinoPort.write('a' + strTargetx + strTargety + str(fire) + fireSelector + scanSelector); // send to arduino
    }

    if ((keyPressed && key == 't') || showRestrictedZones) {
    for (int col = 0; col <= restrictedZone; col++) {
    noStroke();
    fill(0, 255, 0, 100);
    rect(fireRestrictedZones[col][0], fireRestrictedZones[col][2], fireRestrictedZones[col][1]-fireRestrictedZones[col][0], fireRestrictedZones[col][3]-fireRestrictedZones[col][2]);
    }
    }
    if (selectingColor) {
    stroke(190, 0, 190);
    strokeWeight(2);
    fill(red(currFrame[(mouseY*width)+mouseX]), green(currFrame[(mouseY*width)+mouseX]), blue(currFrame[(mouseY*width)+mouseX]));
    rect(mouseX+2, mouseY+2, 30, 30);
    }

    if (selectingSafeColor) {
    stroke(0, 255, 0);
    strokeWeight(2);
    fill(red(currFrame[(mouseY*width)+mouseX]), green(currFrame[(mouseY*width)+mouseX]), blue(currFrame[(mouseY*width)+mouseX]));
    rect(mouseX+2, mouseY+2, 30, 30);
    }

    soundTimer++;
    if (soundTimer == soundInterval) {
    randomIdleSound();
    soundTimer = 0;
    }

    for (int i = 9; i >= 1; i--) {
    prevFire[i] = prevFire[i-1];
    }
    prevFire[0] = fire;
    int sumNewFire = prevFire[0] + prevFire[1] + prevFire[2] + prevFire[3] + prevFire[4];
    int sumPrevFire = prevFire[5] + prevFire[6] + prevFire[7] + prevFire[8] + prevFire[9];

    if (sumNewFire == 0 && sumPrevFire == 5) { // target departed screen
    int s = int(random(0, 6));
    if (s == 0)
    playSound(1);
    if (s == 1)
    playSound(5);
    if (s == 2)
    playSound(9);
    if (s == 3)
    playSound(12);
    if (s == 4)
    playSound(13);
    if (s == 5)
    playSound(20);
    }

    if (fire == 1)
    strokeWeight(3);
    if (fire == 0)
    strokeWeight(1);
    stroke(255, 0, 0); //draw crosshairs
    noFill(); //
    line(displayX, 0, displayX, camHeight); //
    line(0, displayY, camWidth, displayY); //
    ellipse(displayX, displayY, 20, 20); //
    ellipse(displayX, displayY, 28, 22); //
    ellipse(displayX, displayY, 36, 24); //

    updateControlPanels();
    prevTargetX = targetX;
    prevTargetY = targetY;
    }

    void autonomousMode() {
    if(inputDeviceIsSetup) {
    checkInputDevice();
    }

    if (selectingColor || selectingSafeColor) {
    cursor(1);
    }
    else {
    cursor(0);
    }
    camInput.update();
    rawBackground = camInput.retinaImage();
    rawImage = camInput.image();
    if (mirrorCam) {
    for (int i = 0; i < camWidth*camHeight; i++) {
    int y = floor(i/camWidth);
    int x = i - (y*camWidth);
    x = camWidth-x;
    currFrame[i] = rawImage[(y*camWidth) + x-1];
    Background[i] = rawBackground[(y*camWidth) + x-1];
    }
    }
    else {
    currFrame = rawImage;
    Background = rawBackground;
    }

    loadPixels();
    int safeColorPixelsCounter = 0;

    for (int i = 0; i < camWidth*camHeight; i++) {
    if (showCameraView) {
    pixels[i] = currFrame[i];
    }
    else {
    pixels[i] = color(0, 0, 0);
    }

    boolean motion = (((abs(red(currFrame[i])-red(Background[i])) + abs(green(currFrame[i])-green(Background[i])) + abs(blue(currFrame[i])-blue(Background[i]))) > (200-tolerance)) && trackingMotion);
    boolean isTrackedColor = (((abs(red(currFrame[i])-trackColorRed) + abs(green(currFrame[i])-trackColorGreen) + abs(blue(currFrame[i])-trackColorBlue)) < trackColorTolerance) && trackingColor);

    boolean isSafeColor = (((abs(red(currFrame[i])-safeColorRed) + abs(green(currFrame[i])-safeColorGreen) + abs(blue(currFrame[i])-safeColorBlue)) < safeColorTolerance) && safeColor);

    if (motion || isTrackedColor) {
    screenPixels[i] = color(255, 255, 255);
    if (showDifferentPixels) {
    if (effect == 0) {
    pixels[i] = color(diffPixelsColor[0], diffPixelsColor[1], diffPixelsColor[2]);
    }
    else if (effect == 1) {
    pixels[i] = color((diffPixelsColor[0] + red(currFrame[i]))/2, (diffPixelsColor[1] + green(currFrame[i]))/2, (diffPixelsColor[2] + blue(currFrame[i]))/2);
    }
    else if (effect == 2) {
    pixels[i] = color(255-red(currFrame[i]), 255-green(currFrame[i]), 255-blue(currFrame[i]));
    }
    else if (effect == 3) {
    pixels[i] = color((diffPixelsColor[0] + (255-red(currFrame[i])))/2, (diffPixelsColor[1] + (255-green(currFrame[i])))/2, (diffPixelsColor[2] + (255-blue(currFrame[i])))/2);
    }
    }
    }
    else {
    screenPixels[i] = color(0, 0, 0);
    }

    if (isSafeColor) {
    safeColorPixelsCounter++;
    pixels[i] = color(0, 255, 0);
    screenPixels[i] = color(0, 0, 0);
    }
    }



    updatePixels();

    int biggestBlobArea = 0;
    target.computeBlobs(screenPixels);
    for (int i = 0; i < target.getBlobNb()-1; i++) {
    blob = target.getBlob(i);
    int blobWidth = int(blob.w*camWidth);
    int blobHeight = int(blob.h*camHeight);
    if (blobWidth*blobHeight >= biggestBlobArea) {
    biggestBlob = target.getBlob(i);
    biggestBlobArea = int(biggestBlob.w*camWidth)*int(biggestBlob.h*camH eight);
    }
    }
    possibleX = 0;
    possibleY = 0;

    if (biggestBlobArea >= minBlobArea) {
    possibleX = int(biggestBlob.x * camWidth);
    possibleY = int(biggestBlob.y * camHeight);
    }


    if ((biggestBlobArea >= minBlobArea)) {
    fire = 1;
    if (showTargetBox) {
    stroke(255, 50, 50);
    strokeWeight(3);
    fill(255, 50, 50, 150);
    rect(int(biggestBlob.xMin*camWidth), int(biggestBlob.yMin*camHeight), int((biggestBlob.xMax-biggestBlob.xMin)*camWidth), int((biggestBlob.yMax-biggestBlob.yMin)*camHeight));
    }

    anticipation();

    if (activeSmoothing) {
    xdiff = possibleX - oldX; // smoothing
    ydiff = possibleY - oldY; // smoothing
    possibleX = int(oldX + xdiff*(1.0-smoothingFactor)); // smoothing
    possibleY = int(oldY + ydiff*(1.0-smoothingFactor)); // smoothing
    }

    displayX = possibleX;
    displayY = possibleY;
    if (displayX < 0)
    displayX = 0;
    if (displayX > camWidth)
    displayX = camWidth;
    if (displayY < 0)
    displayY = 0;
    if (displayY > camHeight)
    displayY = 0;
    targetX = int((possibleX/xRatio)+xMin);
    targetY = int(((camHeight-possibleY)/yRatio)+yMin);
    oldX = possibleX; // smoothing
    oldY = possibleY; // smoothing
    }
    else {
    fire = 0;
    }

    boolean clearOfZones = true;
    for (int col = 0; col <= restrictedZone; col++) {
    if (possibleX > fireRestrictedZones[col][0] && possibleX < fireRestrictedZones[col][1] && possibleY > fireRestrictedZones[col][2] && possibleY < fireRestrictedZones[col][3]) {
    clearOfZones = false;
    fire = 0;
    }
    }


    if (safeColorPixelsCounter > safeColorMinSize && safeColor) {
    noStroke();
    fill(0, 255, 0, 150);
    rect(0, 0, width, height);
    fire = 0;
    targetX = int((xMin+xMax)/2.0);
    targetY = int(yMin);
    displayX = camWidth/2;
    displayY = camHeight;
    }
    }

    void manualMode() {
    cursor(1);
    camInput.update();
    rawBackground = camInput.retinaImage();
    rawImage = camInput.image();
    if (mirrorCam) {
    for (int i = 0; i < camWidth*camHeight; i++) {
    int y = floor(i/camWidth);
    int x = i - (y*camWidth);
    x = camWidth-x;
    currFrame[i] = rawImage[(y*camWidth) + x-1];
    Background[i] = rawBackground[(y*camWidth) + x-1];
    }
    }
    else {
    currFrame = rawImage;
    Background = rawBackground;
    }

    loadPixels(); //draw camera view to screen
    for (int i = 0; i < camWidth*camHeight; i++) { //
    pixels[i] = currFrame[i]; //
    } //
    updatePixels(); //

    if(inputDeviceIsSetup) {
    checkInputDevice();
    }
    if(useInputDevice) {
    updateInputDevice(); // determine control values using the input device (see declaration in Input_Device tab)
    }else{
    targetX = int((mouseX/xRatio)+xMin); // calculate position to go to based on mouse position
    targetY = int(((camHeight-mouseY)/yRatio)+yMin); //
    displayX = mouseX;
    displayY = mouseY;
    if (mousePressed) {
    fire = 1;
    }
    else {
    fire = 0;
    }
    }
    }


    void mousePressed() {
    if (keyPressed && key == 'r') {
    print("constraints:" + mouseX + ", " + mouseY);
    fireRestrictedZones[restrictedZone][0] = mouseX;
    fireRestrictedZones[restrictedZone][2] = mouseY;
    }
    if (selectingColor) {
    trackColorRed = int(red(currFrame[(mouseY*width)+mouseX]));
    trackColorBlue = int(blue(currFrame[(mouseY*width)+mouseX]));
    trackColorGreen = int(green(currFrame[(mouseY*width)+mouseX]));
    selectingColor = false;
    }

    if (selectingSafeColor) {
    safeColorRed = int(red(currFrame[(mouseY*width)+mouseX]));
    safeColorBlue = int(blue(currFrame[(mouseY*width)+mouseX]));
    safeColorGreen = int(green(currFrame[(mouseY*width)+mouseX]));
    selectingSafeColor = false;
    }
    }

    void mouseReleased() {
    if (keyPressed && key == 'r') {
    println(" ... " + mouseX + ", " + mouseY);
    fireRestrictedZones[restrictedZone][1] = mouseX;
    fireRestrictedZones[restrictedZone][3] = mouseY;
    if (fireRestrictedZones[restrictedZone][1]>fireRestrictedZones[restrictedZone][0] && fireRestrictedZones[restrictedZone][1]>fireRestrictedZones[restrictedZone][2]) {
    restrictedZone++;
    }
    }
    }

    void keyReleased() {
    if ( key == 'p') {
    randomIdleSound();
    }

    if (key == ' ') {
    controlMode = !controlMode;
    }

    if (key == 'b') {
    camInput.adapt();
    playSound(15);
    }
    if (key == 'a') {
    xMin = float(targetX);
    xRatio = (camWidth / (xMax - xMin)); // used to allign sights with crosshairs on PC
    }
    if (key == 'd') {
    xMax = float(targetX);
    xRatio = (camWidth / (xMax - xMin)); // used to allign sights with crosshairs on PC
    }
    if (key == 's') {
    yMin = float(targetY);
    yRatio = (camHeight/ (yMax - yMin)); //
    }
    if (key == 'w') {
    yMax = float(targetY);
    yRatio = (camHeight/ (yMax - yMin)); //
    }
    }



    public void viewCameraSettings() {
    camInput.settings();
    playSound(21);
    }

    public void openWebsite() {
    link("https://sites.google.com/site/projectsentrygun/");
    playSound(15);
    }

    public void setBackground() {
    camInput.adapt();
    playSound(11);
    }

    public void playRandomSound() {
    randomIdleSound();
    }

    public void selectColor() {
    selectingColor = true;
    }

    public void selectSafeColor() {
    selectingSafeColor = true;
    }

    public void radioEffect(int ID) {
    effect = ID + 1;
    }


    public void stop() {
    s1.rewind();
    s1.play();
    delay(2500);
    s1.close();
    s2.close();
    s3.close();
    s4.close();
    s5.close();
    s7.close();
    s6.close();
    s8.close();
    s9.close();
    s10.close();
    s11.close();
    s12.close();
    s13.close();
    s14.close();
    s15.close();
    s16.close();
    s17.close();
    s18.close();
    s19.close();
    s20.close();
    s21.close();
    minim.stop();
    if (!runWithoutArduino) {
    arduinoPort.write("z0000000");
    delay(500);
    arduinoPort.stop();
    }
    camInput.stop();
    super.stop();
    }
    "Speed has never killed anyone. Suddenly becoming stationary - that's what gets you."
    Jeremy Clarkson.

    Kawasaki 200mph Club

  2. #2
    Join Date
    18th February 2005 - 10:16
    Bike
    CT110 Super Cub - postie bike
    Location
    Christchurch
    Posts
    3,123
    May I refer you to the 'PressF1' forum. http://pressf1.pcworld.co.nz/forum.php You think we have shitfights here on KB? Just spend an evening or two on PressF1 and we will seem like a tame bunch of kindy kids.
    Grow older but never grow up

  3. #3
    Join Date
    17th February 2005 - 11:36
    Bike
    Bikes!
    Location
    Christchurch
    Posts
    9,649
    It's the line import Jmyron.* doing it. See the other imports, make sure the Jmyron library is stored in the same place as those, it's probably a folder in the Arduino IDE's folder. I've stopped using that and now use the Arduino plugin for Visual Studio. Much much faster and easier, plus you get all the nice VS IDE features.

  4. #4
    Join Date
    25th April 2009 - 17:38
    Bike
    RC36, RC31, KR-E, CR125
    Location
    Manawatu
    Posts
    7,364
    Quote Originally Posted by imdying View Post
    It's the line import Jmyron.* doing it. See the other imports, make sure the Jmyron library is stored in the same place as those, it's probably a folder in the Arduino IDE's folder. I've stopped using that and now use the Arduino plugin for Visual Studio. Much much faster and easier, plus you get all the nice VS IDE features.
    +1, would be my guess too. If you don't want to move the file (winsearch to find it), just add its path to system, or include the path as an additional project library. Is that plugin for the micros behind arduino as well? I avoid of arduino stuff as it just as easy to do custom board design, and a lot cheaper!
    "A shark on whiskey is mighty risky, but a shark on beer is a beer engineer" - Tad Ghostal

  5. #5
    Join Date
    21st September 2006 - 21:35
    Bike
    Kawasaki ZX1100 Turbo
    Location
    Auckland
    Posts
    3,100
    Quote Originally Posted by imdying View Post
    It's the line import Jmyron.* doing it. See the other imports, make sure the Jmyron library is stored in the same place as those, it's probably a folder in the Arduino IDE's folder. I've stopped using that and now use the Arduino plugin for Visual Studio. Much much faster and easier, plus you get all the nice VS IDE features.
    Terrific cheers, will take a look
    "Speed has never killed anyone. Suddenly becoming stationary - that's what gets you."
    Jeremy Clarkson.

    Kawasaki 200mph Club

  6. #6
    Join Date
    25th April 2009 - 17:38
    Bike
    RC36, RC31, KR-E, CR125
    Location
    Manawatu
    Posts
    7,364
    Also, I've found OpenCV and its GPU libraries very handy for image processing, if that might be useful for you? Spent about 3 days just getting it all installed, similar massive headaches with library files... So if you want some installation tips, I've found a few!
    "A shark on whiskey is mighty risky, but a shark on beer is a beer engineer" - Tad Ghostal

  7. #7
    Join Date
    21st September 2006 - 21:35
    Bike
    Kawasaki ZX1100 Turbo
    Location
    Auckland
    Posts
    3,100
    Quote Originally Posted by bogan View Post
    Also, I've found OpenCV and its GPU libraries very handy for image processing, if that might be useful for you? Spent about 3 days just getting it all installed, similar massive headaches with library files... So if you want some installation tips, I've found a few!
    I should add my total programming experience before I started consisted of "drawing a flag using RMBasic on a Spectrum Sinclair ZX when I was about 12" - this is one heck of a learning curve already!

    If I can get the libraries to play ball the rest 'should' just work.

    Anything after that should be just around me tweaking the settings and perhaps adding GPS, WiFi capabilities etc which I should be able to handle with time.
    "Speed has never killed anyone. Suddenly becoming stationary - that's what gets you."
    Jeremy Clarkson.

    Kawasaki 200mph Club

  8. #8
    Join Date
    13th April 2007 - 17:09
    Bike
    18 Triumph Tiger 1050 Sport
    Location
    UK
    Posts
    3,802
    Nice one Disco Dan and it looks like you have a great result.

    Though sticking pins in yourself might be less painful

    Good luck

  9. #9
    Join Date
    25th April 2009 - 17:38
    Bike
    RC36, RC31, KR-E, CR125
    Location
    Manawatu
    Posts
    7,364
    Quote Originally Posted by Disco Dan View Post
    If I can get the libraries to play ball the rest 'should' just work.
    We'll check back in a week shall we?

    Seriously though, good luck, but don't be surprised if there are days where you are just chasing down little errors. Implicit casting not working as you expect, pointer and addressing errors.... etc. I've just got back into C++ after years of C# and a decent amount of embedded device programming with C/C++, and still a lot to learn, and more than a few trip up on the 'simple' stuff. So don't get disheartened if it takes a lot longer than expected, if you can locate the error to within 10 lines of code me or someone else here should be able to offer advice.
    "A shark on whiskey is mighty risky, but a shark on beer is a beer engineer" - Tad Ghostal

  10. #10
    Join Date
    21st September 2006 - 21:35
    Bike
    Kawasaki ZX1100 Turbo
    Location
    Auckland
    Posts
    3,100
    Quote Originally Posted by bogan View Post
    I avoid of arduino stuff as it just as easy to do custom board design, and a lot cheaper!
    I remember etching my own PCB's in school - was great fun.

    At this stage I have the Arduino board and this mass of wires, resisters, LED's etc going all over the place on a big breadboard. Once I enter the development stage of my project I will be looking at ditching the breadboard and creating a custom shield.

    ...ps no-one has asked what it does yet
    "Speed has never killed anyone. Suddenly becoming stationary - that's what gets you."
    Jeremy Clarkson.

    Kawasaki 200mph Club

  11. #11
    Join Date
    21st September 2006 - 21:35
    Bike
    Kawasaki ZX1100 Turbo
    Location
    Auckland
    Posts
    3,100
    Quote Originally Posted by bogan View Post
    We'll check back in a week shall we?
    *ahem* yes most likely!
    "Speed has never killed anyone. Suddenly becoming stationary - that's what gets you."
    Jeremy Clarkson.

    Kawasaki 200mph Club

  12. #12
    Join Date
    25th April 2009 - 17:38
    Bike
    RC36, RC31, KR-E, CR125
    Location
    Manawatu
    Posts
    7,364
    Quote Originally Posted by Disco Dan View Post
    ...ps no-one has asked what it does yet
    We must be a superstitious bunch then, we'll ask once you have got it sussed out
    "A shark on whiskey is mighty risky, but a shark on beer is a beer engineer" - Tad Ghostal

  13. #13
    Join Date
    6th May 2012 - 10:41
    Bike
    invisibike
    Location
    pulling a sick mono
    Posts
    6,054
    Blog Entries
    4
    you're right. and there's much better arduino spaces online for advice.
    i'm no arduino fan, nor C++ fan.

    missing dependent libraries, obviously points, to missing dependent libraries. check you have jmyron and ALL DEPENDENCIES available.

    also, i thought arduino was a proprietary language, so if you're compiling from c++ to arduino you may be mucking up some links.

    also, look for a debugger to run your script through, fucked if i'm reading it.

  14. #14
    Join Date
    17th April 2009 - 14:06
    Bike
    GN250 2005
    Location
    Hamilton
    Posts
    104
    Blog Entries
    6
    as stated most likely the file JMyron is not located in the source directory, or you have not linked the dependencies in your IDE to show the pre-processor where to grab those as well, so it finds JMyron and allows code to compile then once running and trying to make a call to a JMyron dependency it fails to make call as the class is not there.

    are you sure this is not Java instead of C++? it's been a while since I looked at code that wasn't some form of scripting language, but hey here is some advice you want it.

    the intended use of an "IF" statement is in the form of if then else. if you have a situation that calls for if then or if then or if then, the more appropriate statement to use is a Switch statement, it's more efficient and easier to read, hope this helps.

    an error handler is a piece of code that wraps around your function calls to catch errors, that way if a function call comes back with an unexpected result like a 'null' value it doesn't just end the application and throw up an un-handled exception error, it can log the error or display a message to help you work out at what point the error occurred, it can also let the application continue if possible, google it and debugging will get easier, or you can just comment in a print line statement each time you attempt something, if your getting an error and think it's associated with a certain area of code un comment the print lines and you will see in the console records of what was last attempted before crash occurred.



    oh yeah, and what does it do? my first guess was an atuo aim/kill bot for games that uses a webcam instead of reading memory space or .dll injection, then I thought it might be for an automated drone that tracks and follows objects, then I thought it was for motion activated camera that follows objects that come into view and takes stills. and now I'm not sure.

    Zerker
    "I know your about to do something apocalyptically evil but hey, still want to hang"

  15. #15
    Join Date
    25th April 2009 - 17:38
    Bike
    RC36, RC31, KR-E, CR125
    Location
    Manawatu
    Posts
    7,364
    Quote Originally Posted by Akzle View Post
    i thought arduino was a proprietary language
    Definitely not. Arduinos are just Atmegas in a general purpose breakout PCB, they have a dumbed down SDK which is probably what you're thinking of (which Disco is obviously not using), but I'm pretty sure it is just a library of basic C++ functions wrapped up in an easy to use interface.
    "A shark on whiskey is mighty risky, but a shark on beer is a beer engineer" - Tad Ghostal

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •