Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 7 months ago.
Driving a simple transistor
Hello,
I want to test if my transistor is broken or not. The type of the transistor I use is BC547B. I thought this would be very simple but I didn't make it work yet. I made a basic circuit as shown in the following link:
The voltage source is a 9V battery with the plus connected to a 1k resistor to reduce the current that will flow through the LED. The 1k resistor is connected to the LED (correctly) and the LED is connected to the collector of the transistor. Pin 8 from the mbed is connected to a 2.2k resistor and the resistor is connected to the base of the transistor. The emittor is connected to ground. Now what I do is the following: I make pin 8 as DigitalOut, then in a while loop: make it high, wait 0.5 seconds, make it low and wait for another 0.5 seconds. So it should turn on and off the whole time. But it does nothing that I want it to do.
This is my code:
- include "mbed.h"
DigitalOut base(p8);
int main() { while(1) { base = 1; wait(0.5); base = 0; wait(0.5); } }
I have no idea why this won't work. If anyone could help me I would be very happy.
1 Answer
10 years, 7 months ago.
Did you short the ground of the 9V battery (the - connection) and the ground of the mbed? Otherwise it will not work.