element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Personal Blogs
  • Members
  • More
Personal Blogs
Legacy Personal Blogs Max32 IO Code - first run...
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: patkelly
  • Date Created: 26 Mar 2012 7:03 AM Date Created
  • Views 178 views
  • Likes 1 like
  • Comments 0 comments
Related
Recommended

Max32 IO Code - first run...

patkelly
patkelly
26 Mar 2012

Here is the code that I used to get the OI shield to display, it's a mashup of the demo script and the usual Arduino button script. So if you switch the sliding switch at pin 2 on, the OLED screen turns on, switch it again it goes off.

 

A few prerequisites, when you download the OLED demo from the Max32 website the example code is in a different folder to the files required so make sure you copy all these over to the same directory (it's one those silly little things that gets you scratching your head, for ages going "but it's right, just work"):

 

  • ChrFont0.c
  • delay.c
  • delay.h
  • FillPat.c
  • IOSheildOled.cpp
  • IOShieldOled.h
  • OledChar.c
  • OledChar.h
  • OLedDriver.c
  • OledDriver.h
  • OledGrph.c
  • OledGrph.h

 

 

<-------Code Start--------->

 

#include <IOShieldOled.h>

 

const int buttonPin = 2;

int buttonState = 0;  

 

void setup()

{

  IOShieldOled.begin();

  pinMode(buttonPin, INPUT);

}

 

void loop()

{

  int irow;

  int ib;

 

  //Clear the virtual buffer

  IOShieldOled.clearBuffer();

 

  //Chosing Fill pattern 0

  IOShieldOled.setFillPattern(IOShieldOled.getStdPattern(0));

  //Turn automatic updating off

  IOShieldOled.setCharUpdate(0);

 

 

  buttonState = digitalRead(buttonPin);

 

  // check if the pushbutton is pressed.

  // if it is, the buttonState is HIGH:

  if (buttonState == HIGH) {    

    // turn LED on:   

    IOShieldOled.displayOn();

  }

  else {

    // turn LED off:

    IOShieldOled.displayOff();

  }

 

 

  for (irow = 0; irow < IOShieldOled.rowMax; irow++)

  {

    IOShieldOled.clearBuffer();

    IOShieldOled.setCursor(0, 0);

    IOShieldOled.putString("element14.com");

    IOShieldOled.setCursor(0, 1);

    IOShieldOled.putString("Community");

    IOShieldOled.setCursor(0, 2);

    IOShieldOled.putString("by PK");

    IOShieldOled.setCursor(0, 3);

    IOShieldOled.putString("Not bad eh!");

    IOShieldOled.updateDisplay();

    delay(100);

  }

 

  delay(100);

 

}

 

 

<------------Code End--------------->    

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube