Summer Fun with Arduino Challenge

The challenges

Follow the instructions in the "Challenge 1 Notes" tab to wire up a Secret Squirrel Code Generator then enter your code here

There are 3 challenges, starting from the fun and interactive to the deep and educational.

Build an Arduino LED Binary Counter

Using your own Arduino starter kit (or the nifty web based Arduino simulator), we want you to build a simple LED binary counter by placing and wiring up a series of LED lights and connecting them to the Arduino. Here are the steps:

Please read Ryan's excellent Arduino starter articles to get you on your way. You can choose between using an Arduino device or using Tinkercad. Either way, your entry counts

Whip out your Arduino kit or use the Arduino Simulator provided

Set up the Arduino IDE (online or Desktop)

Follow the instructions provided in Ryan's articles to build a binary counter by placing and wiring up a series of LED lights and connecting them to the Arduino

Follow the instructions in the "How to Enter Challenge 1" tab to wire up a Secret Squirrel Code Generator.

Run the app to find the ‘secret code’ that results from your work and then enter the result in the Code Entry page

Simple right? Go dig out your Arduino and play!

Estimated time to complete: 15 - 20 mins

Showcase your other working Arduino projects

Post a working Arduino project, with full source, as an article on CodeProject in the Arduino section as a CodeProject article.

Your project can be for any purpose: a plant watering system, a solar energy tracker, a security system, or something that randomly injects pics of Guy Fieri into npm packages. Whatever the purpose, just package it up and post your work as an article on CodeProject.

Winners will be judged on innovation, usefulness, ease of use of the code on a real Arduino, and general presentation of the project.

Estimated time to complete: 30 - 60 mins to write about 500 words

Demonstrate Your overall IoT Expertise

If you’re an IoT expert, this is the place to show it off! Post an article on CodeProject that highlights your choice in IoT development.

The focus of this challenge is to teach concepts to readers unfamiliar with the technology (or teach readers how to stretch themselves with advanced concepts). Brief examples that are to the point are better than full blown projects. Focus on the concepts you are trying to teach.

Topics may include tutorials, code samples and walkthroughs, intros on how to program new and emerging technologies (eg. LoRaWAN, Low power operation, Bluetooth, Mesh). Maybe you want to write about embedded or Raspberry Pi development, or HomeKit or Google Home integration, or Docker with IoT, Azure or AWS. The possibilities are endless; let your imagination go wild.

Winners will be judged on clarity of ideas, readability, technical prowess and general presentation of the article.

Estimated time to complete: Depends on the length of the article

How do I show I’ve completed the Arduino LED binary counter challenge?

As part of the binary counter challenge, you’ll be adding a bit of C++ that turns your e-mail address into a personalized binary code. You will then be able to enter this code on the contest page. For instructions, see the notes in Challenge 1 above.

How do I publish my IoT contest articles?

Choose your topic, come up with a brilliant idea, write and submit your article to the Internet of Things chapter. Contestants have until the contest deadline to write and submit as many articles as they wish (each article should focus on a single technology or platform).

A main challenge to learning Arduino programming is that there is no debugger that will show you what your hardware is actually doing. Learn how easy it is to connect an LCD to write "logging" statements.

Chris is the Co-founder, Administrator, Architect, Chief Editor and Shameless Hack who wrote and runs CodeProject. He is also co-founder of Developer Media and ContentLab.IO. He's been programming since the 80's and has been, in various guides, an astrophysicist, bacyard mechanic, mathematician, physicist, breeder of carnivorous plants, hydrologist, geomorphologist, defence intelligence researcher and then, when all that got a bit rough on the nerves, a web developer.

His programming experience includes C/C++, C#, SQL, MFC, ASP.NET, TypeScript and far, far too much FORTRAN. He has worked on PocketPCs, Old mainframes, new Macs, cheap phones, and a CRAY YMP C90 behemoth but finds notebooks take up less desk space.

He is kind to small animals and has a soft spot for cheesecake.

Chris was born and bred in Australia but splits his time between Toronto and Melbourne, depending on the weather. For relaxation he is obsessively into road cycling, physiology, occasionally snowboarding and rock climbing, and wishes he were a storm chaser.

I started photo-etching circuit boards when I was 8, and at 11 was haunting the halls and computer science labs at the local university so much that I was invited by Professor Wayne Ayott to audit his software and hardware design courses.

Over my career I have used C# , C++, Win32, MFC, Assembler, Basic, and Clipper, on applications for the military, commercial ventures, medical research and the labour movement. Through my medical informatics work I came to know what real-time and mission-critical really mean… just try being part of the critical path when a woman goes into labor.

I have been honoured to receive many business, industry and leadership awards including being named an Exceptional Young Entrepreneur (Profit Magazine) and to the list of Who's Who in Canadian Business. The companies I started have been recognized as the Fastest Growing companies in Canada (Profit Magazine), as the Fastest Growing North American Technology Companies (Deloitte & Touché) and named as a Top 100 Innovator and Leader by SDTimes 6 years in a row.

EE degree, first taste of programming was 6502 assembler. Toyed with BASIC a little, but my first real projects were in x86 assembler. From there I went to C, working on 80186/NEC V30 embedded systems and frontend PC apps for them. After that it was OCX development in C++, consuming those custom OCXes and DLLs in a Visual Basic front end. Currently working for a website application, where I wear multiple hats including System Administrator, Network Administrator, Database Administrator (MS SQL), SQL programmer, ASP programmer (VB.Net, some C#), JavaScript programmer. Currently moving our web application to the Azure Cloud. So I can hang up a few of those hats For fun I like to play with embedded systems, Arduino and recently a Raspberry Pi that I won in the Code Project Arduino challenge. That has got me interested in Python.

Florian lives in Munich, Germany. He started his programming career with Perl. After programming C/C++ for some years he discovered his favorite programming language C#. He did work at Siemens as a programmer until he decided to study Physics.

During his studies he worked as an IT consultant for various companies. After graduating with a PhD in theoretical particle Physics he is working as a senior technical consultant in the field of home automation and IoT.

Florian has been giving lectures in C#, HTML5 with CSS3 and JavaScript, software design, and other topics. He is regularly giving talks at user groups, conferences, and companies. He is actively contributing to open-source projects. Florian is the maintainer of AngleSharp, a completely managed browser engine.

Eugene is a Multidisciplinary Engineer from Purdue University. His concentration is in Visual Design Engineering, with a minor in Product Life Management.
He is a hobbyist tinkerer with a love for combining artistic vision with engineering rigor. His multidisciplinary background means there's enjoyment to be found at all corners of a project.

Born in Hungary, got my first computer at age 12 (C64 with tape and joystick). Also got a book with it about 6502 assembly, that on its back has a motto, said 'Try yourself!'. I believe this is my beginning...

Started to learn - formally - in connection to mathematics an physics, by writing basic and assembly programs demoing theorems and experiments.

After moving to Israel learned two years in college and got a software engineering degree, I still have somewhere...

Since 1997 I do development for living. I used 286 assembly, COBOL, C/C++, Magic, Pascal, Visual Basic, C#, JavaScript, HTML, CSS, PHP, ASP, ASP.NET, C# and some more buzzes.

Since 2005 I have to find spare time after kids go bed, which means can't sleep to much, but much happier this way...

All my life I have been passionate about architecture / software design, as this is the cornerstone to a maintainable and extensible application. As such, I have enjoyed exploring some crazy ideas and discovering that they are not so crazy after all. I also love writing about my ideas and seeing the community response. As a consultant, I've enjoyed working in a wide range of industries such as aerospace, boatyard management, remote sensing, emergency services / data management, and casino operations. I've done a variety of pro-bono work non-profit organizations related to nature conservancy, drug recovery and women's health.

I've been a professional developer since the late 90's and got hired on with Doubl-Kold in may of 2000 through February of 2018. I have since moved on to Van Doren Sales for new challenges. I have a few core languages under my belt, but D-lang has gotten my interest lately.

I currently have interest into more embedded systems, as they continue to fascinate me more than any other technologies currently.

The majority of my free time is spent on my wife and kids, and numerous other hobbies.

As Senior Architect, Matthew is responsible for the Architecture, Design, and Coding of the CodeProject software as well as Manager of the Infrastructure that runs the web site.

Matthew works on improving the performance and experience of the Code Project site for users, clients, and administrators.

Matthew has more years of software development, QA and architecture experience under his belt than he likes to admit. He graduated from the University of Waterloo with a B.Sc. in Electrical Engineering. He started out developing micro-processor based hardware and software including compilers and operating systems.
His current focus is on .NET web development including jQuery, Webforms, MVC, AJAX, and patterns and practices for creating better websites.
He is the author of the Munq IOC, the fastest ASP.NET focused IOC Container.
His non-programming passions include golf, pool, curling, reading and building stuff for the house.

10+ experience in Design and development of AM/FM/GIS and IT related Geospatial projects.
Completed my Graduation from GBDT, Davangere in CompSci&Engg. Have 3+ years of experience in teaching undergraduate students and currently working at NIC, New Dlehi in the capacity of Technical Director, New Delhi.

I'm a full stack web developer, having 8 years of experience in web development. I love coding so much, I do it in my spare time too. I work with C#, and all the other things that usually go with it, like:
• ASP.NET MVC
• Angular & Typescript
• SQL Server
• HTML, Javascript & CSS
• Entity Framework

Roger has worked in IT for over 25 years in numerous roles (Technical Support, Quality Assurance, Capacity & Performance Engineering and Software Development).
During that time, he has recognized that software often just becomes another layer of work that the user has to wade through.
Sometimes technical documentation is like that too: so confusing and complex that it wastes developers' time.
That's why when he writes his books like Programming Windows 10 Via UWP and his articles (Practical Electronics For Makers) he strives to explain things in the shortest available space with the simplest language possible. Often that means, writing in a tutorial style with numerous images to help guide the user.
He believes the best guiding principle is Einstein's famous quote: "Everything should be made as simple as possible, but not simpler."

I was a Software Engineer for 40+ years starting with mainframes, and moving down in scale through midi, UNIX and Windows PCs. I started as an operator in the 1960s, learning assembler programming, before switching to development and graduating to COBOL, Fortran and PLUS (a proprietary language for Univac systems). Later years were a mix of software support and development, using mainly C, C++ and Java on UNIX and Windows systems.

Since retiring I have been learning some of the newer (to me) technologies (C#, .NET, WPF, LINQ, SQL, Python ...) that I never used in my professional life, and am actually able to understand some of them.

Summer Fun with Arduino Challenge Terms & Conditions

These rules (and the CodeProject® Terms of Use and the CodeProject Contributors Agreement) govern the Summer Fun with Arduino Challenge (the "Contest") and set out the terms and conditions between CodeProject and its affiliates ("CodeProject" or "us/we") and each participant ("participant", "or "you"). A submission to this Contest constitutes your acceptance of these Official Contest Rules (the "Rules").

1. How to Enter: CodeProject is offering the Contest and will award Prizes (as defined below) based on the results of judging all valid entries against the criteria established in these Rules.

The Contest begins on 5 June 2018 at 12AM and ends on 30 June 2018 at 11:59:59 PM US Eastern Standard Time (“Contest Period”). CodeProject’s clock is the official time for the Contest. All entries must be submitted during this period in order to qualify.

No purchase is necessary to enter the Contest or to be eligible to win a Prize.

We are not responsible for lost, illegible, incomplete, mutilated or stolen entries; errors appearing within these Rules, in any Contest related advertisements or other materials; or other errors of any kind whether mechanical, human, electronic or otherwise. Entries that are late, illegible, incomplete, unreadable, damaged, delayed, lost, tampered with, incomprehensible, forged, mutilated, misdirected, inaccurate, unintelligible or otherwise not in compliance with these Rules will be disqualified. You must provide all of the requested information to submit a valid entry. Only those who live in jurisdictions in which this Contest is legal may enter.

Prizes may be withheld or awarded to another eligible registrant if these Rules are breached.

Prizes may not be exactly as shown. A reasonable US$ equivalent in lieu of the Prize may also be awarded at the sole discretion of CodeProject.

Entries shall be deemed to be submitted by the authorized account holder of the email address submitted at the time of entry unless clearly indicated otherwise. "Authorized account holder" is defined as the natural person who is assigned to an email address by an internet access provider, online service provider, or other organization (e.g. business, educational institution, etc.) that is responsible for assigning email addresses for the domain associated with the submitted email address.

2. Eligibility: This Contest is open to software development professionals & enthusiasts who are of the age of majority in their jurisdiction of residence. Residents of Quebec and of the following countries are ineligible to participate due to legal constraints: Cuba, Iran, Iraq, Libya, North Korea, Sudan, and Syria. All national and local laws and regulations of the participant’s country of residence apply. Residents of countries under U.S. embargo are not eligible to enter. Employees, officers and representatives (and members of their immediate families and those living in the same household of each) of CodeProject, its parents, subsidiaries and affiliated companies, advertising and promotion agencies, and any company involved in the design, execution, production of this Contest ("Contest entities") are ineligible. CodeProject reserves the right to verify participant eligibility at any time and all participants may be required to provide verification of eligibility. Void where prohibited. You must enroll or be enrolled as a member of Codeproject.com to be eligible to win a Prize in this Contest.

3. Determination of winners:

Up to $5000 in prizes will be awarded, but only a valid entry in compliance with these Rules is eligible to win a Prize. All participants in challenge 1 will be eligible to win one of 35 Raspberry Pi 3 B+ Starter Kits from CanaKit.

The Articles will be judged based on the following elements:

Advanced IoT tutorial articles:

how clear, pertinent and enjoyable the entry is;

how effectively the participant is able to explain the new technology or platform and demonstrate his/ her IoT expertise

Personal IoT project articles:

how innovative and functional the project is;

the overall execution and presentation of an entry itself

In addition, the votes and comments each submission receives on the CodeProject website may be taken into account. Judges decisions are final. You may withdraw your submission at any time by notifying CodeProject. Your right to win a Prize is terminated if a submission is withdrawn.

Winners will be notified by email following selection and may also be announced in the Daily Build newsletter or other sections of CodeProject.com. We shall have no liability for any winner notification that is lost, intercepted or not received by the potential winner for any reason and we are not obligated to leave voice mail, answering machine or other message. Proof of response by a potential winner does not constitute proof of receipt by us.

All winners will be notified via email. If after seven (7) days of the second notification to the winner no acknowledgement or response is received, the Prize is forfeited, and CodeProject will select another winner.

Each winner acknowledges that, if and to the extent that CodeProject is legally obligated to provide a third party with information about any Prize claimed by a winner, CodeProject shall be entitled to do so.

4. Ownership and Publicity: CodeProject does not claim ownership of your submission to the Contest (please see the “Ownership” section in the CodeProject Contributors Agreement), but by submitting an entry, you grant CodeProject, its affiliated companies and necessary sub-licensees a worldwide, perpetual, royalty-free, irrevocable, non-exclusive, fully assignable and transferable right and license, to edit, adapt, translate, reformat your submission, to post your submission (e.g. publish, display, perform, digitally perform) to do what CodeProject feels it needs to do to manage and update the Site, to make and maintain back-up and archival copies, and to make your submission available to End Users in accordance with these Rules, CodeProject’s Contributors Agreement, and the specific EULA that you select.

By participating in the Contest, you expressly allow CodeProject to use and publish, in any medium or format, your name, city and country of residence, voice, statements, video, photographs and other likenesses in connection with any promotion, advertising or publicity without further consideration or notice to you. Any participant’s personal information may be used by CodeProject in order to conduct the Contest. By participating in the Contest, the participant agrees to the use of the participant’s personal information in accordance with CodeProject’s privacy policy, which can be found at http://www.codeproject.com/info/privacy.aspx.

5. Participant Warranties:

By submitting an entry to the Contest, you warrant that your submission:

is a new article or a new version of an article and has not been published previously on CodeProject;

does not contain any content that infringes on any third party rights, including Intellectual Property (IP) rights, and that you own or otherwise have all rights necessary to make your submission, including any and all IP rights;

does not disclose any information which would constitute a violation of any confidentiality obligation;

does not violate any agreement that you have with any third party; and

does not contain any viruses, worms, spyware, or other components or instructions that are malicious, deceptive, or designed to limit or harm the functionality of a computer or computer system.

6. Prizes:

As described below, there will be up to $5,000 in Contest prizes (“Prize” or “Prizes”) awarded.

Articles must be of an acceptable quality, fulfil requirement outlines for the article topic as determined solely by CodeProject, and abide by the Terms of this Contest. The total approximate retail value (“ARV”) of all Prizes will not exceed five thousand ($5,000) USD. All applicable federal, state, and local tax laws apply. The value for any prize is based on the ARV at the beginning of the Contest Period. Because the ARV for any Prize may fluctuate, CodeProject has the sole right to determine the value of any Prize, or its cash equivalent, at the time that any prize is awarded.

Substitution or transfer of Prizes is not allowed. In CodeProject’s sole discretion, it may award a substitute prize of equal or greater value. The winner accepts responsibility for all federal, state and local taxes and fees in connection with the Prizes. If you are a potential winner, we may require you to sign an Affidavit of Eligibility, Liability/Publicity Release and a W-9 tax form or W-8 BEN tax form within seven (7) business days of notification. In certain countries, such as Canada, a winner may be required to correctly answer a skill testing question before becoming eligible to claim a Prize.

Apart from any Prize that may be awarded as part of the Contest, no compensation (monetary or otherwise) will be paid for your Contest submission. CodeProject is not responsible for Contest entries not received due to lost, failed, delayed or interrupted connections or miscommunications, or other electronic malfunctions. CodeProject is not responsible for incorrect or inaccurate entry information, whether caused by you or any other persons or by any of the equipment or programming associated with or utilized in the Contest.

The Prize will be shipped to the winner’s residence using standard delivery. CodeProject is not responsible for a Prize if it is lost, stolen or damaged during or after shipping, and it will not be replaced by CodeProject.

7. Warranties and Disclaimers: Prizes come with the standard manufacture warranty only (if applicable), but Prizes are awarded “AS IS”. To the fullest extent allowable by law, CodeProject specifically disclaims any representations or warranties, express or implied, regarding the Contest or the Prizes including any implied warranty of merchantability or fitness for a particular purpose and implied warranties arising from course of dealing or course of performance.

8. Release of Liability, Issues of Law and Indemnity: By participating in the Contest, all participants release CodeProject, its affiliates, partners, subsidiaries, officers, directors, agents, employees and all entities associated with the development and execution of this promotion from any and all liability with respect to and in any way arising from participating in this promotion, acceptance or use of a Prize. CodeProject assumes no responsibility for incorrect or inaccurate capture of entry information, technical malfunctions, human or technical error, lost, delayed or garbled data or transmissions, omission, interruption, deletion, defect or failures of any telephone or computer line or network, computer equipment, software or any combination thereof. Entry materials/data that have been tampered with or altered are void. If for any reason, in the opinion of CodeProject in its sole discretion, the Contest is not capable of running as originally planned, or if the administration, security, fairness, integrity or the proper conduct of the Contest is corrupted or adversely affected, including by reason of infection by computer virus, bugs, tampering, unauthorized intervention, fraud, technical failures or any other causes beyond its control, CodeProject reserves its right to cancel, terminate, modify, amend, extend or suspend the Contest including cancelling any method of entry, and select a winner from previously received eligible entries. CodeProject reserves its right in its sole discretion to disqualify any individual it finds to be tampering with the entry process or the operation of the Contest or to be violating the letter or spirit of the Rules or is otherwise acting in a disruptive manner. CodeProject reserves its right to seek remedies and damages to the fullest extent of the law for any attempts to deliberately damage the Contest web site or to undermine the legitimate operation of this Contest. CodeProject shall not be held responsible for any errors or negligence that may arise or occur in connection with the Contest including any damage to an entrant's computer equipment, system, software or any combination thereof, as a result of their participation in this Contest or from downloading any material from the Contest website where applicable. All participants agree to fully indemnify and hold harmless CodeProject from any and all claims by third parties relating to the Contest without limitation.

9. Generally: CodeProject may make changes to these Rules at any time without notice to you. Participating in the Contest or accepting a Prize will constitute acceptance of the revised rules. These Rules prevail in the event of any conflict or inconsistency with any other communications, including advertising or promotional materials.

All trade names, trademarks, registered trademarks, product names and company names or logos mentioned or displayed in connection with the Contest are the property of their respective owners and may not be used in any manner whatsoever without the express written consent of their respective owners.

If, for reasons beyond CodeProject’s control (including, but not limited to, tampering or computer virus infection), the Contest is not capable of running as originally planned, CodeProject, at its sole discretion reserves the right to cancel or modify the Contest, without liability or further notice. CodeProject will not be responsible for lost, late, misdirected, damaged, or illicit submissions, or for Internet, computer hardware and software, phone, and other technical errors, omissions malfunctions, and delays. Entries are void if they contain material typographical or other errors. All entrants agree to comply fully with each provision in these Rules. Any person attempting to defraud or in any way tamper with this Contest and any person who does not comply with these Rules, will be ineligible for any Prize(s) and may be prosecuted to the fullest extent of the law.

For any feedback or questions regarding the Contest or the Prizes please contact contest@codeproject.com.

10. Winners' List: For a list of Prize winners, please contact contest@codeproject.com with the Subject Line “Summer Fun with Arduino Challenge Winners List” by July 31, 2018

Discussions

If we connect LEDs to the pins of a single port and write byte codes into that port instead of single bits in a loop then the program becomes much simpler. 2 lines in setup() and 2 lines in loop() methods and no overhead with C++ class. Not sure if I need to publish it as a follow-up article or just post here ?

It looks to me like (and from my debug tests) that the hash value inside the for loop (bolded in previous code sample) would get set a new value each time through the loop. I believe that means the only value that would count is the last char in incoming string array.

I believe the code should be:

hash += (uint8_t) (((hash << 5) ^ (hash >> 3)) ^ str[i]);

Probably need that to add the value to the final hash value each time, right?
But, I definitely could be wrong.

Each iteration assigns a value to hash that depends on previous versions of hash, and hence all characters are taken into account.

This algorithm was taken from Knuth, but if it's wrong then I'm happy to adjust.

However all we're really after is something that does a little bit of non-obvious work to force a little bit of programming action. It technically fulfils its purpose even if there's cut and paste errors.

Project Verification

Once you have your secret code please enter it in the Enter Code page.

Once you have your Arduino (or simulation) up and running it's time to add a little code to generate a code that you will enter in our contest system to prove you've completed the challenge. It’ll only take a few easy steps to make your Arduino generate the contest code.

First, open your CodeProject profile page (click on your name at the top right of CodeProject.com while logged in) and find your member ID number directly under above your profile picture.

In the Arduino IDE or Tinkercad code window, paste the following function at the top of the file before any other code:

Next, inside the BinaryCounter::increment() method, find the line that reads:

binaryDigits = getBinaryDigits(valuetoShow)

an change it to:

binaryDigits = getBinaryDigits(Hash(“00000000”))

Now, replace the string of zeros with your CodeProject member ID.

If you’re using Arduino hardware, connect the Arduino hardware to your PC and use the Arduino IDE to upload the code. If you’re using Tinkercad, you don’t need to do anymore more with your code as all the changes you make are available to the simulated Arduino immediately.

Proceed to the next section if you’re using a physical Arduino. If you’re using Tinkercad, skip ahead to the ‘Tinkercad Instructions’ section.

Hardware Instructions

If your Arduino is plugged in to a power source, unplug it.

Find the wire that connects analog port 0 on the Arduino to the breadboard

Unplug it from the breadboard, and plug it into the top negative power rail on the breadboard. Leave it plugged in to analog port 0 on the Arduino.

Connect your Arduino to a power source. The LEDs will light up and give you an 8 digit code to enter. If the LED is off, it represents a 0. If it is on, it represents a 1. For example, the LEDs in the image below represent the code 01110010.

Tinkercad Instructions

Delete the wire connecting analog pin 0 on the Arduino to the breadboard.

Connect a new wire from analog pin 0 on the Arduino to the upper negative power rail on the breadboard:

Click the ‘Start Simulation’ button. The LEDs will light up and give you an 8 digit code to enter. If the LED is off, it represents a 0. If it is on, it represents a 1. For example, the LEDs in the image below represent the code 01110010.