99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

SCC.369代做、代寫C/C++編程設計
SCC.369代做、代寫C/C++編程設計

時間:2024-11-09  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



SCC.369 Coursework 1: Working with GPIO
Moodle submission 16:00 Friday week 4; weighting 33% of module.
Aim
Having familiarized yourself with the C development environment and the basic process of writing to 
registers to control the GPIO pins, in this coursework you will explore some of the other functionality 
that’s possible with GPIO pins. Along the way you will get more comfortable working with registers 
to control the MCU and a better idea of the capabilities of the nRF52 series of MCUs. You will also 
start working with breadboards and electronic components.
Instructions for all subtasks
The coursework is split into a number of subtasks, listed below. Implement each one of them from 
first principles using pure C. This means that you are NOT permitted to use any library functions that 
you have not written yourself (apart from for debugging over serial) – only #include "MicroBit.h". In 
addition to C keywords and C operators, you can use typedefs, structs and literals from the nRF SDK.
We will be looking at and testing your code with the help of some automated scripts, so it’s super 
important that you follow the following guidelines. If you do not, you will lose marks:
1. Write and submit your CW in a file called CW1.cpp. 
2. Start with the template CW1.cpp file on Moodle because it has all the functions correctly 
listed, you just need to write the code for each one!
3. Within CW1.cpp, write your code for each subtask within the indicated section of the file.
4. Do not change the specified function prototypes (i.e. function name, parameters and return 
type) for each subtask, use the ones given in the CW1.cpp template.
5. Do not include a main() function or main.cpp file in your submission, although you will of 
course need to use one for your own testing. You might like to use the main() in 
MainSubtaskRunner.cpp because that’s what we will use when we test your code. 
For each subtask, 20-30% of the marks will depend on code quality. The kinds of things we will be 
looking for include:
• Visually well-formatted and readable code
• Good, elegant code structure and style, e.g.:
o Appropriate use of loops, helper functions, literals etc.
o Initialise MCU peripherals only once where possible, e.g. don’t keep setting the 
direction register of a GPIO port if the directions don’t keep changing.
o Only change the bits of a register that you need to, e.g. AND or OR in the bits you 
need to change. 
• Ample and thoughtful comments including:
o Before function definitions explaining function purpose, parameters etc.
o What variables are used for
o The choice of bit patterns and/or literals being written to registers
o The purpose of writing to registers
o The purpose of loops etc.
• No commented-out code with no explanation!
Remember to have fun . Use the labs to ask about anything you don’t understand!
Subtask 1, 20%: Display a binary number that counts up at 5Hz
This subtask requires you to write two functions as follows:
Function prototype: void displayBinary(uint8_t value);
Set the bit pattern of a row of LEDs on the micro:bit to match the least significant 5 bits of the
unsigned 8-bit value provided as a parameter. The least significant bit should be on the right when 
looking at the micro:bit with the USB cable pointing up. A ‘1’ in a bit position should turn the 
corresponding LED on, a ‘0’ should turn the LED off. You can use any row of LEDs on the micro:bit to 
show this 5 bit number, but only use one row – the LEDs on the other rows should not light up.
The first time displayBinary() is called it will need to initialise GPIOs. It’s good practice not to 
repeatedly re-initialise registers with the same value, so you could use a local static variable to 
record the first time displayBinary() is called so that subsequent calls don’t repeatedly initialise.
Function prototype: void countUpBinary(uint8_t initialValue);
Write a function that causes the number on the row you chose above to count up in binary, one 
count at a time, starting at the value passed in. You should call your displayBinary() function from 
above. After reaching a displayed count of 0b11111 the counter should ‘keep going’, i.e. wrap 
around to 0b00000. The frequency of counting should be 5Hz, i.e. 5 counts per second or 200ms per 
count. Think about how you can test the frequency of counting; the stretch goal is to see if you can 
adjust it to be within 5% of the target. 
Subtask 2, 20%: Display a binary number that counts down/up with buttons A/B
For this subtask you will need to use two GPIO pins as inputs; use the ones connected to buttons A 
and B on the micro:bit. Check the micro:bit schematic to see which GPIOs they use. There is only one 
function to write:
Function prototype: void countWithButtonsBinary(uint8_t initialValue);
This function displays the initial count value passed in, using the displayBinary() function from 
Subtask 1, and updates the display with a new value when a micro:bit button is pressed. Button A 
should decrement the value by one count, and button B should increment it by one. To make this 
work well you will need to debounce the button inputs. The count should wrap around to 0b11111
when decremented below zero, and vice-versa. The count should only change on a button press,
not on a button release, and it should not keep incrementing while a button is held down.
Remember to use the relevant PIN_CNF[x] register to access all the settings you need.
Subtask 3, 25%: Measure and display an analogue voltage
NB the week 3 lecture will explain aspects of this Subtask.
For this subtask you will configure the GPIO connected to micro:bit pin P0 as an analogue input and 
read the voltage present on that pin. To test this you will need to apply a variable analogue voltage 
to that pin. You’ll need a breadboard, a micro:bit breakout adapter, a variable resistor and some 
jumper wires. 
Wire up the ends of the variable resistor to power and ground, and connect the slider to P0.
For this subtask, in addition to your code please submit a photo of your working 
micro:bit/breadboard setup in .jpg format for some easy marks! Please name it ST3.jpg. 
Function prototype: uint8_t sampleVoltage(void);
2
Write a function to measure the magnitude of the analogue voltage on the large P0 pin of the 
micro:bit edge connector. There are many ways to configure the analogue-to-digital converter (ADC) 
on the nRF, but the important thing is that this function returns an 8-bit unsigned value where 0 
represents an input of 0V and 255 represents an input of 3V (that the MCU is being powered from). 
Wire the variable resistor so that fully anticlockwise produces 0V on the wiper and fully clockwise 
3V. 
Function prototype: void displayVoltageBinary(void);
Write a function to repeatedly display in binary the magnitude of the analogue voltage measured on 
the large P0 pin. Use your displayBinary() function from Subtask 1 and make sure to display the five 
most significant bits of the sampled voltage so that the display reaches 0b00000 when the variable 
resistor is turned fully anticlockwise and 0b11111 when it’s turned fully clockwise. 
Subtask 4, 25%: Drive an RGB LED
NB the week 3 lecture will explain aspects of this Subtask.
For this subtask you will connect an RGB LED to P1 (red), P8 (blue) and P9 (green) on the micro:bit 
edge connector, each via a current-limiting resistor. Use a 220R resistor for red and 100R for blue 
and green. The LED we are using is a common anode type.
Function prototype: void driveRGB(void);
You can drive the P1, P8 and P9 pins as regular GPIO outputs if you want to see how the LED works 
with one or more elements lit up. But for the coursework, control each pin with a PWM signal at 
roughly 1kHz. Driving all three colours at a fixed ratio of 50% on, 50% off gets you over half the 
marks. Making the LED ‘breathe’ by repeatedly fading from completely off to fully on and back over 
the course of 2-4 seconds for a full cycle gets more marks, and the stretch is to have the variable 
resistor from Subtask 3 control the colour at the same time the LED is breathing – a full turn of the 
resistor knob should run through a wide range of colours such that there are no obvious switches 
from one colour to another – a nice, gentle fade through a wide colour palette!
For this subtask, in addition to your code please submit a photo of your working 
micro:bit/breadboard setup in .jpg format for some easy marks! Please name it ST4.jpg. 
Subtask 5, 10%: Display a binary number that counts up/resets on touch input
NB the week 3 lecture will explain aspects of this Subtask.
The final subtask has a lower weighting but is here to stretch you! 
It’s like Subtask 2 but the display should count up by one count when you touch the golden micro:bit 
“face” logo above the LEDs. No need to worry about counting down for this subtask though.
Function prototype: void countWithTouchesBinary(uint8_t initialValue);
This function displays the initial count value passed in, using the displayBinary() function from 
Subtask 1, and increments the displayed number by one when the golden micro:bit face logo is 
touched. A “long-touch” to reset the count to the initialValue will get you extra marks 😊.
Mark Scheme
For each subtask, 70-80% of the marks will be awarded for meeting the functional requirements 
given. 20-30% of the marks will depend on code quality as described on the first page above. If you 
3
4
do not use the filename, function prototypes and hardware configuration specified (all repeated in 
red below) you will lose marks. Your work will be assessed by a combination of automatic processing 
and manual inspection. Your final grade will be based on a weighted mean of your subtask marks.
Subtask Hardware config Weight To be submitted
(submit code in CW1.cpp)
1: Display a binary number 
that counts up at 5Hz One row of micro:bit display 20% displayBinary()
countUpBinary()
2: Display a binary number 
that counts down/up 
with buttons A/B
Same row of micro:bit display;
the micro:bit buttons 20% countWithButtonsBinary()
3: Measure and display an 
analogue voltage
Same row of micro:bit display;
variable resistor wired to edge 
connector pin P0
25%
sampleVoltage()
displayVoltageBinary()
ST3.jpg photo of hardware
4: Drive an RGB LED RGB LED wired to edge 
connector pins P1, P8 and P9 25% driveRGB()
ST4.jpg photo of hardware
5: Display a binary number 
that counts up/resets on 
touch input
Same row of micro:bit display;
the touch-sensitive 
micro:bit ‘face’ logo
10% countWithTouchesBinary()

請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp






 

掃一掃在手機打開當前頁
  • 上一篇:代做INT2067、Python編程設計代寫
  • 下一篇:COMP2211 代做、代寫shell interface程序設計
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
    合肥機場巴士2號線
    合肥機場巴士2號線
    合肥機場巴士1號線
    合肥機場巴士1號線
  • 短信驗證碼 豆包 幣安下載 AI生圖 目錄網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    99爱在线视频这里只有精品_窝窝午夜看片成人精品_日韩精品久久久毛片一区二区_亚洲一区二区久久

          9000px;">

                亚洲你懂的在线视频| 亚洲伊人伊色伊影伊综合网| 亚洲视频资源在线| 色94色欧美sute亚洲13| 亚洲精品欧美二区三区中文字幕| 99re8在线精品视频免费播放| 亚洲精品视频免费看| 欧洲人成人精品| 日本欧洲一区二区| 国产亚洲欧美中文| 99久久99久久精品国产片果冻 | 久久久亚洲高清| 99精品视频中文字幕| 一区二区三区四区国产精品| 69av一区二区三区| 成人久久18免费网站麻豆| 亚洲主播在线观看| 亚洲精品一区二区三区四区高清 | 国产精品美女久久久久久| 欧美午夜一区二区三区| 国产一区二区91| 亚洲午夜在线视频| 久久久午夜精品| 欧美放荡的少妇| av高清久久久| 国产一区二区三区日韩| 偷拍一区二区三区四区| 欧美韩国日本综合| 91精品国产色综合久久久蜜香臀| 成人涩涩免费视频| 蜜臀精品久久久久久蜜臀| 亚洲一区在线视频| 国产精品国产三级国产普通话三级 | 国产欧美精品一区二区色综合 | 欧美做爰猛烈大尺度电影无法无天| 人人精品人人爱| 国产精品成人免费在线| 精品成人在线观看| 日韩欧美美女一区二区三区| 在线观看亚洲专区| 97se狠狠狠综合亚洲狠狠| 国产精品18久久久久久久久| 麻豆国产欧美日韩综合精品二区| 亚洲伊人色欲综合网| 亚洲欧美视频一区| 国产精品成人免费| 亚洲欧洲国产日韩| 亚洲视频在线观看一区| √…a在线天堂一区| 中文字幕国产精品一区二区| 国产欧美日韩不卡免费| 国产精品久久久久久久久久久免费看 | 日本精品裸体写真集在线观看 | 色偷偷久久一区二区三区| 成人av免费在线| 成a人片国产精品| 99视频一区二区| 在线视频一区二区免费| 欧美色视频一区| 欧美一区二区女人| 精品国产污污免费网站入口 | 国产一区二区三区免费看| 久久精品国产色蜜蜜麻豆| 久久99在线观看| 国产成人精品三级麻豆| 成人av免费在线| 欧洲精品一区二区| 日韩精品中文字幕在线一区| 久久久久免费观看| 亚洲色图制服丝袜| 日韩中文字幕麻豆| 国产在线观看一区二区| jizzjizzjizz欧美| 欧美三级韩国三级日本三斤| 欧美另类videos死尸| 欧美成人乱码一区二区三区| 国产色一区二区| 一区二区三区免费看视频| 免费精品99久久国产综合精品| 国产一区在线视频| 91在线观看污| 日韩欧美国产麻豆| 国产精品无遮挡| 日韩专区中文字幕一区二区| 国产69精品久久久久777| 一本色道久久加勒比精品| 日韩欧美中文一区二区| 亚洲欧洲一区二区在线播放| 午夜精品福利在线| 91日韩一区二区三区| 精品成人私密视频| 亚洲国产精品影院| 高清成人在线观看| 91精品国产综合久久精品性色| 国产视频视频一区| 日韩激情一区二区| 一本大道综合伊人精品热热| 欧美大片国产精品| 亚洲一区二区不卡免费| 成人一二三区视频| 精品盗摄一区二区三区| 日韩精品电影一区亚洲| 91在线云播放| 国产精品蜜臀av| 黄色小说综合网站| 欧美一区午夜视频在线观看| 亚洲男女一区二区三区| 国产精品一区二区在线看| 欧美福利电影网| 亚洲成人一区在线| 色婷婷亚洲精品| 亚洲女爱视频在线| 91丨porny丨蝌蚪视频| 久久久久久亚洲综合影院红桃| 亚洲成人午夜影院| 在线观看日韩电影| 亚洲图片自拍偷拍| 欧美在线观看视频在线| 亚洲卡通动漫在线| 欧美伊人久久久久久午夜久久久久| 国产精品电影院| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 欧美三级一区二区| 亚洲一级电影视频| 色狠狠综合天天综合综合| 中文字幕在线观看一区| 成人av动漫在线| 中文字幕永久在线不卡| av影院午夜一区| 亚洲精品日日夜夜| 在线免费视频一区二区| 亚洲成人一二三| 日韩欧美的一区二区| 精品亚洲成a人| 欧美激情资源网| 99久久精品久久久久久清纯| 亚洲免费观看高清完整版在线| 欧美丝袜第三区| 日本亚洲电影天堂| 久久久久久久网| 99久久婷婷国产| 天堂成人国产精品一区| 日韩丝袜美女视频| 成人在线综合网| 亚洲777理论| 精品国产一区二区三区av性色| 成人三级伦理片| 亚洲国产精品久久久久秋霞影院| 制服丝袜亚洲播放| 国产激情精品久久久第一区二区 | 国产ts人妖一区二区| 曰韩精品一区二区| 日韩一级完整毛片| 99久久精品免费观看| 亚洲成人中文在线| 国产人成亚洲第一网站在线播放 | 日本大胆欧美人术艺术动态| 欧美岛国在线观看| 日本久久一区二区三区| 麻豆极品一区二区三区| 日韩一区有码在线| 欧美电影免费观看完整版| 9久草视频在线视频精品| 美女视频免费一区| 亚洲精品v日韩精品| 精品国产91久久久久久久妲己| 一本一道波多野结衣一区二区| 精品一区二区三区的国产在线播放| 亚洲国产高清在线| 欧美一区二区三区四区久久 | 91免费精品国自产拍在线不卡| 蜜臀av性久久久久av蜜臀妖精| 亚洲欧洲成人av每日更新| 欧美变态tickle挠乳网站| 一本到不卡精品视频在线观看| 国产精品88av| 美国欧美日韩国产在线播放| 亚洲精品国产a| 国产精品福利影院| 欧美极品xxx| 久久亚洲免费视频| 欧美大度的电影原声| 欧美网站一区二区| 在线日韩av片| 色播五月激情综合网| heyzo一本久久综合| 成人av电影免费观看| 国产精品一区二区三区网站| 麻豆专区一区二区三区四区五区| 亚洲国产美女搞黄色| 一区二区高清视频在线观看| 国产精品狼人久久影院观看方式| 久久欧美中文字幕| 久久综合久久综合亚洲| 欧美电影免费观看高清完整版| 欧美一区二区成人| 亚洲精品一区二区三区精华液 | 亚洲精品久久7777| 一区二区免费在线播放| 亚洲综合一区二区|