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.
main.cpp
- Committer:
- jack1930
- Date:
- 2020-10-30
- Revision:
- 0:1bdd9095fc1d
File content as of revision 0:1bdd9095fc1d:
/* mbed Microcontroller Library
* Copyright (c) 2019 ARM Limited
* SPDX-License-Identifier: Apache-2.0
*/
/* Anschlüsse:
* MOSI: PB15 - D8
* SCLK: DB13 - D7
*/
#include "mbed.h"
#include "platform/mbed_thread.h"
// Blinking rate in milliseconds
#define BLINKING_RATE_MS 5
DigitalOut summer(D3);
DigitalOut SS(D4);
AnalogIn ain(A0);
// Deklarieren Sie die SPI: SPI anzeige(?, ?, ?);
int seg7[10]={0b11000000,0b11111001,0b10100100,
0b10110000,0b10011001,0b10010010,
0b10000010,0b11111000,0b10000000,
0b10010000};
int tausender(int e)
{
return (seg7[((e%10000)/1000)]<<8)+0b00000001;
}
//ebenso hunderter, zehner und einer
int main()
{
int eingabe;
summer=1; //Summer ausschalten
// Wählen Sie das richtige Format: anzeige.format(???);
while (true) {
eingabe=(int)(ain*4096);
SS=0;
anzeige.write(tausender(eingabe));
SS=1;
thread_sleep_for(BLINKING_RATE_MS);
//Ebenso hunderter, Zehner, Einer
}
}