Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of aReadConditional by
main.cpp
- Committer:
- CSTritt
- Date:
- 2017-09-25
- Revision:
- 5:198bfb6c4a3b
- Parent:
- 4:acc6be2bbe21
File content as of revision 5:198bfb6c4a3b:
/*
Project: PowOf3
File: main.cpp
Simple powers of 3 program. Demonstrates for loops and arrays.
Written by: Dr. C. S. Tritt
Created: 9/25/17 (v. 1.0)
*/
#include "mbed.h"
Serial pc(USBTX, NC, 9600); // Serial transmit only @ 9600 baud.
AnalogIn analog_value(A0); // Construct AnalogIn object called analog_value.
int main() {
printf("\nPowers of 3 Demonstration (v. 1.0)\n"); // Identify program.
const int SIZE = 10; // Number of array elements.
int i; // Loop counter.
int p[SIZE]; // Number of elements.
for(i = 0; i <= SIZE - 1; i++) {
p[i] = (int) pow(3.0, (double) i);
pc.printf(" i = %i and 3^i = %i.\n", i, p[i]);
}
}
