Post Reply 
Intel Edison generic calculator shield photo journal
03-28-2015, 01:22 AM (This post was last modified: 03-28-2015 06:10 AM by MarkHaysHarris777.)
Post: #36
RE: Intel Edison generic calculator shield photo journal
Greetings, well, this is mostly going to be a vision casting post, but also I will be sharing some code and some other things that I have learned this week regarding the Edison and hand-held calculation.

I have stated this a few times, but it does not hurt repeating-- I am not thinking about the hand-held calculator paradigm (stand-alone, not connected, non collaborative, buttons & display); that ship has sailed. I am thinking about a connected system (hardware & network) in which we have direct control of all things hardware (robotics and industrial control) as well as direct access with the network for complete analytics and collaboration... say over and over collaborative and connected. Some have thought the Edison is over-kill; here's a quote from one individual:

(03-23-2015 08:29 PM)matthiaspaul Wrote:  The Edison provides a compound processor with three cores, two Atoms running at 500 MHz and one Quark running at 100 MHz. One of them would be enough to accomplish the task. Also, we don't need 1 GB DRAM in a calculator. 32 MB would be more than enough.

The Quark (dedicated MCU) is going to handle data collection (all types, but I'm thinking specifically scientific) and the Atom(s) are going to handle the analytics. The Quark keeps us connected to the hardware world, and the Atom(s) keep us connected (and collaborating) with the networked world. In such a system we have, as it were, the best of both worlds.

The best part of this plan is its openness and simplicity. Intel has done all of the really hard work. What are we going to make?

If anyone would like to try the Edison, feel free to contact me directly if you get stuck... the getting started docs are not as user friendly as the Arduino docs, and there are some assumptions about the user's knowledge of open systems like gnu/linux. I might be able to help get you going and save you some headaches.

Well, its time to get serious about this/ my generic calculator framework is under way (keyboard build, voltage distribution for all three primary boards) and I've started with the real software on the Intel Edison (very excited about that):

notes:
The code responsible for starting the '/sketch/sketch.elf' file is the clloader service. Restarting the clloader service will start a 'sketch' or restart a crashed sketch. The following commands will start a new sketch uploaded via wifi to /shetch/

ln -sf name-of-new-sketch.cpp.elf sketch.elf
systemctl restart clloader

... the first command sets a symbolic link from 'sketch.elf' to the new sketch just uploaded. 'sketch.elf' is hard coded in the clloader.h file (see sources)/ The second command restarts the clloader service which re-reads the new sketch.elf file through the symbolic link and then runs the new sketch. How cool is that? This means that the unit does not 'require' connection to the pc via usb micro connectors; in fact, no connectors are needed at all!


Some codes:
I thought I might share the codes that I have had running in my edison for a couple of days to check out the MCU and work a bit with the system on gnu/linux... this is a six channel 'LED flasher' with the catch that it doesn't just blink the LEDs... there is a binary LED counter, and a flash all-on all off routine. I'm using a segment LED, but you can use what ever LEDs you have. Be sure to have a level shifter in the middle (see my pics) because the edison is not going to be forgiving about voltage mis-match like the Arduino. Also, I have included an input button that switches between binary counting and 'flashing'. Unlike the Arduino, you will need to include your own pullup resistor.

Code:

/*
  Blinker-Binary-LAB-Intel-Edison

  modified 3-26-2015
  by Mark H. Harris
 */

int k= -1;

void blink_line_13(int count, int on_13, int off_13) {
    int i=0;
    for (int i = 1; i <= count; i++) {
        digitalWrite(13, HIGH);
        delay(on_13);
        digitalWrite(13, LOW);
        delay(off_13);
        }     
    }

// the setup function runs once when you press reset or power the board
void setup() {
  pinMode(13, OUTPUT);             // GP40,  edison J19-10
  pinMode(12, OUTPUT);             // GP42,  edison J20-9
  pinMode(11, OUTPUT);             // GP43,  edison J19-11
  pinMode(10, OUTPUT);             // GP41,  edison J20-10
  pinMode(9, OUTPUT);              // GP183,  edison J18-8
  pinMode(8, OUTPUT);              // GP49,  edison J20-6
  pinMode(5, INPUT_PULLUP);        // GP13,  edison J18-1
  allOff2();
  delay(1000);
  blink_line_13(7, 300, 200);
}

// the loop function runs over and over again forever

void loop() {
  delay(200);
  binaryBlinker6Digital(500);
  allBlink2();
  
}

void allBlink2() {
  while (1) {
    allOn2();
    read5Delay(200);
    allOff2();
    read5Delay(200);
    if (k==0) break;
  }
  allOff2();
  k= -1;
}

void read5Delay(int delayValue) {
    if (digitalRead(5) == LOW) k=0;
    delay(delayValue);
}

void allOff2(void) {
      digitalWrite(13, LOW);
      digitalWrite(12, LOW);
      digitalWrite(11, LOW);
      digitalWrite(10, LOW);
      digitalWrite(9, LOW);
      digitalWrite(8, LOW);
}

void allOn2(void) {
      digitalWrite(8, HIGH);
      digitalWrite(9, HIGH);
      digitalWrite(10, HIGH);  
      digitalWrite(11, HIGH);
      digitalWrite(12, HIGH);
      digitalWrite(13, HIGH);  
}

void binaryDisplay6Digital(int disp_val) {
    int i=0;
    int linenum=8;
    int bindigit=1;
    for (i=1; i<=6; i++) {
       if (disp_val & (int) bindigit) {
          digitalWrite(linenum, HIGH);
       } else {
          digitalWrite(linenum, LOW);
       }
       bindigit *= 2;
       linenum++;
    }
}

void binaryBlinker6Digital(int delay_t) {
  int i=0;
  while (1) {
    binaryDisplay6Digital(++i);
    read5Delay(delay_t);
    if (k==0) break;
  }
  k=-1;
  allOff2();
}

-

Good evening, and good weekend to all...

Cheers,
marcus
Smile

Kind regards,
marcus
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Intel Edison generic calculator shield photo journal - MarkHaysHarris777 - 03-28-2015 01:22 AM



User(s) browsing this thread: 1 Guest(s)